removed comments
This commit is contained in:
@@ -76,7 +76,6 @@ export const useAPIStore = defineStore('api', () => {
|
||||
return axios.get(`${API_BASE_URL}/games?${queryParams}`)
|
||||
}
|
||||
|
||||
// --- ADICIONADO: Função que faltava ---
|
||||
const getCurrentUserGames = (params = {}) => {
|
||||
const queryParams = new URLSearchParams({
|
||||
page: params.page || 1,
|
||||
@@ -91,7 +90,6 @@ export const useAPIStore = defineStore('api', () => {
|
||||
|
||||
return axios.get(`${API_BASE_URL}/users/${authStore.currentUserID}/games?${queryParams}`)
|
||||
}
|
||||
// --------------------------------------
|
||||
|
||||
const getCurrentUserMatches = (params = {}) => {
|
||||
const queryParams = new URLSearchParams({
|
||||
|
||||
@@ -3,13 +3,14 @@ import { ref, computed } from 'vue'
|
||||
import { useAPIStore } from './api'
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
|
||||
const DEFAULT_TIMEOUT = 30 * 60 * 1000
|
||||
const REMEMBER_ME_TIMEOUT = 365 * 24 * 60 * 60 * 1000
|
||||
|
||||
const currentUser = ref(undefined)
|
||||
const token = ref(localStorage.getItem('token') || null)
|
||||
const tokenExpiry = ref(localStorage.getItem('tokenExpiry') ? parseInt(localStorage.getItem('tokenExpiry')) : null)
|
||||
const tokenExpiry = ref(
|
||||
localStorage.getItem('tokenExpiry') ? parseInt(localStorage.getItem('tokenExpiry')) : null,
|
||||
)
|
||||
const rememberMe = ref(false)
|
||||
|
||||
const isLoggedIn = computed(() => {
|
||||
@@ -25,9 +26,9 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
})
|
||||
|
||||
const isTokenAlmostExpired = () => {
|
||||
if (!tokenExpiry.value) return false;
|
||||
return Date.now() > (tokenExpiry.value - 60 * 1000);
|
||||
};
|
||||
if (!tokenExpiry.value) return false
|
||||
return Date.now() > tokenExpiry.value - 60 * 1000
|
||||
}
|
||||
|
||||
const resetTokenExpiry = () => {
|
||||
const timeout = rememberMe.value ? REMEMBER_ME_TIMEOUT : DEFAULT_TIMEOUT
|
||||
@@ -106,7 +107,6 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
currentUser.value = userResp.data
|
||||
localStorage.setItem('currentUser', JSON.stringify(userResp.data))
|
||||
} catch (apiError) {
|
||||
// API call failed, likely token is invalid
|
||||
logout()
|
||||
return false
|
||||
}
|
||||
@@ -117,7 +117,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}
|
||||
|
||||
const updateCurrentUserCoins = (coins) => {
|
||||
if (!currentUser.value) return;
|
||||
if (!currentUser.value) return
|
||||
currentUser.value.coins_balance = coins
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,6 @@ export const useBiscaStore = defineStore('bisca', () => {
|
||||
playerScore.value = 0
|
||||
winner.value = 'opponent'
|
||||
|
||||
// Parar o jogo imediatamente
|
||||
isGameRunning.value = false
|
||||
isGameOver.value = true
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ export const useSocketStore = defineStore('websocket', () => {
|
||||
disconnect,
|
||||
joinGame,
|
||||
playCard,
|
||||
surrender, // Exported
|
||||
surrender,
|
||||
onTrickEnd,
|
||||
onGameOver
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user