Handle the case of no avatar (#2959)
* Handle the case of no avatar * ci go * Scope to the top if... * Account for CI's usage of dev API key causing avatar to show
This commit is contained in:
@ -126,11 +126,17 @@ async function getUser(context: UserContext) {
|
||||
if (!token && isTauri()) return Promise.reject(new Error('No token found'))
|
||||
if (token) headers['Authorization'] = `Bearer ${context.token}`
|
||||
|
||||
if (SKIP_AUTH)
|
||||
if (SKIP_AUTH) {
|
||||
// For local tests
|
||||
if (localStorage.getItem('FORCE_NO_IMAGE')) {
|
||||
LOCAL_USER.image = ''
|
||||
}
|
||||
|
||||
return {
|
||||
user: LOCAL_USER,
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
const userPromise = !isTauri()
|
||||
? fetch(url, {
|
||||
@ -144,6 +150,11 @@ async function getUser(context: UserContext) {
|
||||
|
||||
const user = await userPromise
|
||||
|
||||
// Necessary here because we use Kurt's API key in CI
|
||||
if (localStorage.getItem('FORCE_NO_IMAGE')) {
|
||||
user.image = ''
|
||||
}
|
||||
|
||||
if ('error_code' in user) return Promise.reject(new Error(user.message))
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user