add comments
This commit is contained in:
parent
a243deb79e
commit
1dcd26ffcf
@ -25,8 +25,11 @@ export default (): useAuth => {
|
||||
user.setUserInfo(userInfo)
|
||||
useI18n({}).setLang(userInfo.lang)
|
||||
if (allowRoles.indexOf(userInfo.role) >= 0 ) {
|
||||
// user is authenticated and authorized, let the user in
|
||||
return
|
||||
}
|
||||
|
||||
// user is authenticated but not authorized for this page
|
||||
if (user.isAdmin) {
|
||||
document.location.pathname = '/admin'
|
||||
// can't use navigateTo() for it fails with DOMException if two consecutive redirects happen (at least in docker container)
|
||||
@ -35,6 +38,7 @@ export default (): useAuth => {
|
||||
document.location.pathname = '/play'
|
||||
}
|
||||
} catch (e) {
|
||||
// user is not authenticated
|
||||
if (allowRoles.indexOf('') == -1 ) {
|
||||
document.location.pathname = '/'
|
||||
}
|
||||
|
23
client/src/stores/ServerinfoStore.ts
Normal file
23
client/src/stores/ServerinfoStore.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export type Serverinfo = {
|
||||
isInitialized: boolean
|
||||
}
|
||||
|
||||
export const useServerinfoStore = defineStore('ServerinfoStore', {
|
||||
state: () => {
|
||||
return {
|
||||
Serverinfo: {
|
||||
isInitialized: false,
|
||||
} as Serverinfo,
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
isInitialized: (state): boolean => state.Serverinfo.isInitialized,
|
||||
},
|
||||
actions: {
|
||||
setServerinfo(Serverinfo: Serverinfo): void {
|
||||
this.Serverinfo = Serverinfo
|
||||
},
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue
Block a user