fix: Make login not use top level await
This commit is contained in:
1 parent
f0523b0c3f
commit
16ff3055b0
1 file changed
+6
-8
+6
-8
@@ -23,20 +23,18 @@ export interface AuthData {
|
|||||||
instance: string
|
instance: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const authData = writable<AuthData | undefined>(
|
export const authData = writable<AuthData | undefined>()
|
||||||
await (() => {
|
export const user = writable<GetPersonDetailsResponse>()
|
||||||
if (typeof localStorage != 'undefined') {
|
|
||||||
|
if (typeof localStorage != 'undefined') {
|
||||||
if (localStorage.getItem('user')) {
|
if (localStorage.getItem('user')) {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(localStorage.getItem('user') ?? '')
|
authData.set(JSON.parse(localStorage.getItem('user') ?? ''))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
localStorage.removeItem('user')
|
localStorage.removeItem('user')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})()
|
|
||||||
)
|
|
||||||
export const user = writable<GetPersonDetailsResponse>()
|
|
||||||
|
|
||||||
authData.subscribe(async (data) => {
|
authData.subscribe(async (data) => {
|
||||||
if (!data) return
|
if (!data) return
|
||||||
|
|||||||
Reference in new issue
Block a user