Skip to content

Commit cb18ab8

Browse files
committed
fix: database auth
1 parent 3c31f3f commit cb18ab8

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/screens/surrealist/pages/Connection/connection/connection.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,13 @@ async function isNamespaceValid(namespace: string) {
931931
}
932932

933933
async function isDatabaseValid(database: string) {
934+
const connection = getConnection();
935+
const authDB = connection && getAuthDB(connection.authentication);
936+
937+
if (authDB === database) {
938+
return true;
939+
}
940+
934941
try {
935942
const [result] = await instance.query("INFO FOR NS").collect<[SchemaInfoNS]>();
936943
const databases = Object.keys(result?.databases ?? {}).map((db) => parseIdent(db));

src/util/databases.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export async function fetchDatabaseList(namespace: string): Promise<NamespaceOrD
159159
const authDB = getAuthDB(connection.authentication);
160160

161161
if (authDB) {
162-
return [authDB];
162+
return [{ name: authDB }];
163163
}
164164

165165
const [_, result] = await executeQuery(

0 commit comments

Comments
 (0)