Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/timer-db/TimerDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class TimerDB {
this.storage = new PouchDBStorage();
}

startSync(params: { username: string; password: string }): void {
this.storage.connectRemoteDB(params.username, params.password);
startSync(params: { username: string; password: string; options?: {dbURL: string} }): void {
this.storage.connectRemoteDB(params.username, params.password, params.options);
}

// TODO: provide a way to get only sessions with solves.
Expand Down
4 changes: 2 additions & 2 deletions src/timer-db/storage/PouchDBStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class PouchDBStorage {
// });
}

connectRemoteDB(username: string, password: string): void {
const url = new URL(DB_URL);
connectRemoteDB(username: string, password: string, options?: {dbURL: string} ): void {
const url = options === null ? new URL(DB_URL) : new URL(options.dbURL)
url.username = username;
url.password = password;
url.pathname = `results-${localStorage.timerDBUsername}`;
Expand Down
2 changes: 1 addition & 1 deletion src/timer-db/storage/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SessionUUID } from "../UUID";
export type SyncChangeListener = (attempt: StoredAttempt[]) => void;

export declare interface Storage {
connectRemoteDB(username: string, password: string): void;
connectRemoteDB(username: string, password: string, options?: {dbURL: string} ): void;

// Sessions
createSession(
Expand Down