diff --git a/src/machines/authMachine.ts b/src/machines/authMachine.ts index 138d672fa..d5ca65a8b 100644 --- a/src/machines/authMachine.ts +++ b/src/machines/authMachine.ts @@ -118,16 +118,14 @@ async function getUser(context: UserContext) { if (!context.token && '__TAURI__' in window) throw 'not log in' if (context.token) headers['Authorization'] = `Bearer ${context.token}` if (SKIP_AUTH) return LOCAL_USER - try { - const response = await fetch(url, { - method: 'GET', - credentials: 'include', - headers, - }) - const user = await response.json() - if ('error_code' in user) throw new Error(user.message) - return user - } catch (e) { - console.error(e) - } + const response = await fetch(url, { + method: 'GET', + credentials: 'include', + headers, + }) + + const user = await response.json() + if ('error_code' in user) throw new Error(user.message) + + return user }