@samitouri / QOSami-HFS / commits / 1b1fc239

fix: create-admin #579

Massimo Melina committed Apr 30, 2024 at 18:30 UTC 1b1fc239da1fc3471867140bb60ffc940621e0b0
1 file changed +2 -1
src/perm.ts
+2 -1
@@ -52,8 +52,9 @@ export function saveSrpInfo(account:Account, salt:string | bigint, verifier: str
52 const createAdminConfig = defineConfig('create-admin', '')
53 createAdminConfig.sub(v => {
54 if (!v) return
55 - createAdmin(v)
55 createAdminConfig.set('')
56 + // we can't createAdmin right away, as its changes will be lost after return, when our caller (setConfig) applies undefined properties. setTimeout is good enough, as the process is sync.
57 + setTimeout(() => createAdmin(v))
58 })
59
60 export async function createAdmin(password: string, username='admin') {