fix: suppress error when fetching user information in application loader

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-08-14 20:56:49 +02:00
parent 5e06e4ab3c
commit f3450d66a9

View file

@ -11,6 +11,9 @@ import { fetchAndSetUser } from '../../login-page/auth/utils'
import { fetchFrontendConfig } from './fetch-frontend-config'
import { loadDarkMode } from './load-dark-mode'
import { isDevMode, isTestMode } from '../../../utils/test-modes'
import { Logger } from '../../../utils/logger'
const logger = new Logger('Application Loader')
/**
* Create a custom delay in the loading of the application.
@ -33,6 +36,14 @@ export interface InitTask {
task: () => Promise<void>
}
const fetchUserInformation = async (): Promise<void> => {
try {
await fetchAndSetUser()
} catch (error) {
logger.error("Couldn't load user. Probably not logged in.")
}
}
/**
* Create a list of tasks, that need to be fulfilled on startup.
*/
@ -52,7 +63,7 @@ export const createSetUpTaskList = (): InitTask[] => {
},
{
name: 'Fetch user information',
task: fetchAndSetUser
task: fetchUserInformation
},
{
name: 'Motd',