mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
fixed unwanted redirect to start page
This commit is contained in:
@@ -156,14 +156,18 @@ const router = useRouter()
|
||||
const isPrintMode = useMediaQuery('print')
|
||||
|
||||
onMounted(() => {
|
||||
useUserPreferenceStore().init()
|
||||
useUserPreferenceStore().init().then(() => {
|
||||
if (useUserPreferenceStore().activeSpace.spaceSetupCompleted != undefined && !useUserPreferenceStore().activeSpace.spaceSetupCompleted) {
|
||||
router.push({name: 'WelcomePage'})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* global title update handler, might be overridden by page specific handlers
|
||||
*/
|
||||
router.afterEach((to, from) => {
|
||||
if(to.name == 'StartPage' && !useUserPreferenceStore().activeSpace.spaceSetupCompleted != undefined &&!useUserPreferenceStore().activeSpace.spaceSetupCompleted && useUserPreferenceStore().activeSpace.createdBy.id! == useUserPreferenceStore().userSettings.user.id!){
|
||||
if(to.name == 'StartPage' && useUserPreferenceStore().initCompleted && !useUserPreferenceStore().activeSpace.spaceSetupCompleted != undefined &&!useUserPreferenceStore().activeSpace.spaceSetupCompleted && useUserPreferenceStore().activeSpace.createdBy.id! == useUserPreferenceStore().userSettings.user.id!){
|
||||
router.push({name: 'WelcomePage'})
|
||||
}
|
||||
nextTick(() => {
|
||||
|
||||
@@ -45,6 +45,11 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
|
||||
*/
|
||||
let isAuthenticated = ref(false)
|
||||
|
||||
/**
|
||||
* complete refresh of all data from server completed
|
||||
*/
|
||||
const initCompleted = ref(false)
|
||||
|
||||
const theme = useTheme()
|
||||
const router = useRouter()
|
||||
|
||||
@@ -233,7 +238,9 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
|
||||
promises.push(loadSpaces())
|
||||
updateTheme()
|
||||
|
||||
return Promise.allSettled(promises)
|
||||
return Promise.allSettled(promises).then(() => {
|
||||
initCompleted.value = true
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -246,6 +253,7 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
|
||||
spaces,
|
||||
activeUserSpace,
|
||||
isAuthenticated,
|
||||
initCompleted,
|
||||
loadUserSettings,
|
||||
loadServerSettings,
|
||||
updateUserSettings,
|
||||
|
||||
Reference in New Issue
Block a user