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