fix some bugs

This commit is contained in:
2026-06-27 13:49:00 +03:30
parent c3b47e33e1
commit 4d004c3515
13 changed files with 331 additions and 57 deletions
+12 -5
View File
@@ -1,4 +1,8 @@
import { getTokenName } from '@/themeConfig'
import {
clearStoredAuthTokens,
findStoredAuthToken,
persistAuthToken,
} from '@/utils/authToken'
import { ref } from 'vue'
import {useConfigStore} from "@/store/configStore";
@@ -11,7 +15,10 @@ const nameProject= getConfigApp('name')
function setToken(token: string | undefined) {
return localStorage.setItem(getTokenName(), token)
if (!token) {
return
}
return persistAuthToken(token)
}
function setFingerPrint(val: string | undefined) {
@@ -19,7 +26,7 @@ function setFingerPrint(val: string | undefined) {
}
function getToken() {
return localStorage.getItem(getTokenName())
return findStoredAuthToken()
}
function getIsActiveFingerprint() {
@@ -56,7 +63,7 @@ export async function authenticateWithFingerprint() {
const credentialId = btoa(String.fromCharCode(...new Uint8Array(credential.rawId)))
// بازیابی توکن از localStorage
const token = localStorage.getItem(`${nameProject}_app_token`)
const token = findStoredAuthToken()
if (!token) {
console.warn('توکن پیدا نشد، عملیات متوقف شد.')
@@ -78,7 +85,7 @@ export async function authenticateWithFingerprint() {
function removeToken() {
return localStorage.removeItem(getTokenName())
return clearStoredAuthTokens()
}
function removeFingerPrint() {