Admin platform, with users, transactions, games and admin creation

This commit is contained in:
Edd
2026-01-02 16:17:55 +00:00
parent b9df0a4d4a
commit e89b60c844
14 changed files with 959 additions and 24 deletions
+12 -1
View File
@@ -4,7 +4,7 @@ import { useAPIStore } from './api'
export const useAuthStore = defineStore('auth', () => {
const DEFAULT_TIMEOUT = 5 * 60 * 1000
const DEFAULT_TIMEOUT = 30 * 60 * 1000
const REMEMBER_ME_TIMEOUT = 365 * 24 * 60 * 60 * 1000
const currentUser = ref(undefined)
@@ -20,6 +20,10 @@ export const useAuthStore = defineStore('auth', () => {
return currentUser.value?.id
})
const isAdmin = computed(() => {
return currentUser.value?.type === 'A'
})
const isTokenAlmostExpired = () => {
if (!tokenExpiry.value) return false;
return Date.now() > (tokenExpiry.value - 60 * 1000);
@@ -112,10 +116,16 @@ export const useAuthStore = defineStore('auth', () => {
return true
}
const updateCurrentUserCoins = (coins) => {
if (!currentUser.value) return;
currentUser.value.coins_balance = coins
}
return {
currentUser,
isLoggedIn,
currentUserID,
isAdmin,
token,
rememberMe,
getToken,
@@ -124,5 +134,6 @@ export const useAuthStore = defineStore('auth', () => {
resetTokenExpiry,
isTokenAlmostExpired,
restoreSession,
updateCurrentUserCoins,
}
})