Skip to content

Commit 4b95908

Browse files
committed
refactor: renamed switchDatabase => switchDefaultDatabase to better match composable name
1 parent 33afa28 commit 4b95908

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/runtime/composables/useSwitchDefaultDatabase.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ import type { ClientDatabaseManager } from "../utils/clientDatabaseManager"
99
*
1010
* See {@link ClientDatabaseManager.switchDefaultDatabase} for more info.
1111
*/
12-
export async function useSwitchDefaultDatabase(...args: Parameters<ClientDatabaseManager["switchDatabase"]>): Promise<void> {
13-
return useGlobalClientDatabaseManager().switchDatabase(...args)
12+
export async function useSwitchDefaultDatabase(...args: Parameters<ClientDatabaseManager["switchDefaultDatabase"]>): Promise<void> {
13+
return useGlobalClientDatabaseManager().switchDefaultDatabase(...args)
1414
}

src/runtime/utils/clientDatabaseManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ export class ClientDatabaseManager {
151151
return entry
152152
}
153153

154-
switchDatabase(name: string, { errorIfNotFound = true }: { errorIfNotFound?: boolean } = {}) {
155154
/**
156155
* This only changes the default database used by useClientDb, it does not init/re-init anything.
157156
*
158157
* You can pass { errorIfNotFound: false } to allow setting to an undefined database (to, for example, allow deletion of the database on logout).
159158
*/
159+
switchDefaultDatabase(name: string, { errorIfNotFound = true }: { errorIfNotFound?: boolean } = {}) {
160160
this.getEntry(name, { errorIfNotFound })
161161
this.defaultDatabaseName = name
162162
}

0 commit comments

Comments
 (0)