add educate page
This commit is contained in:
+16
-13
@@ -43,17 +43,15 @@ const currentRoute = computed(() => {
|
||||
})
|
||||
|
||||
async function start() {
|
||||
|
||||
// console.log('ffffffffffffffffffffffffffffffffffffffffff')
|
||||
if (getToken()) {
|
||||
// await userStore.getMyInfo()
|
||||
await walletStore.getLimitedPrice()
|
||||
await walletStore.getLimitedBuyGold()
|
||||
await fundStore.getMyFund()
|
||||
}
|
||||
|
||||
}
|
||||
const win = window as Window & { isWhatsappBtnAdded?: boolean };
|
||||
|
||||
const win = window as Window & { isWhatsappBtnAdded?: boolean }
|
||||
|
||||
export function setTruth() {
|
||||
fingerPosition = true
|
||||
@@ -89,7 +87,6 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
// Start a new timeout to reset fingerprint after 5 seconds of inactivity
|
||||
if (from.name !== 'login' || from.name !== undefined) {
|
||||
console.log(from.name)
|
||||
timeoutId = setTimeout(async () => {
|
||||
if (hasFingerPrint) {
|
||||
fingerPosition = false
|
||||
@@ -109,8 +106,8 @@ router.beforeEach(async (to, from, next) => {
|
||||
// If the user has a token
|
||||
if (getToken()) {
|
||||
await userStore.getMyInfo()
|
||||
const finger_print =userStore.userInfo.finger_print
|
||||
console.log(finger_print)
|
||||
const finger_print= userStore.userInfo.finger_print
|
||||
// console.log(finger_print)
|
||||
// const { finger_print } = await getMe()
|
||||
hasFingerPrint = finger_print
|
||||
// If on an Apple device and fingerprint exists
|
||||
@@ -129,7 +126,6 @@ router.beforeEach(async (to, from, next) => {
|
||||
goToLogin(to, next) // Redirect to login if authentication fails
|
||||
}
|
||||
} else {
|
||||
console.log('salam')
|
||||
if (from.path === '/') {
|
||||
// goToHome(to, next)
|
||||
}
|
||||
@@ -140,7 +136,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
} else {
|
||||
// If no token, handle redirect to login or allow access to login or 404
|
||||
if (['login', '404'].includes(to.name as string)) {
|
||||
if (['login', '404','educate'].includes(to.name as string)) {
|
||||
return next() // Allow access to login or 404
|
||||
}
|
||||
goToLogin(to, next) // Redirect to login if no token
|
||||
@@ -157,7 +153,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
return next() // Proceed to the intended route
|
||||
} else {
|
||||
// If no token, ensure proper redirection to login or 404
|
||||
if (['login', '404'].includes(to.name as string)) {
|
||||
if (['login', '404','educate'].includes(to.name as string)) {
|
||||
return next() // Allow access to login or 404
|
||||
}
|
||||
return next({ name: 'login' })
|
||||
@@ -168,15 +164,22 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (getToken() && !hasFingerPrint) {
|
||||
next()
|
||||
} else {
|
||||
goToLogin(to, next)
|
||||
if (['login', '404','educate'].includes(to.name as string)) {
|
||||
if (to.name === 'login'){
|
||||
goToLogin(to, next)
|
||||
return
|
||||
} else {
|
||||
return next()
|
||||
}
|
||||
// Allow access to login or 404
|
||||
}
|
||||
}
|
||||
/* if (to.name !== 'login') {
|
||||
return next({ name: 'login' }) // Redirect to login
|
||||
} else {
|
||||
return next() // If already on the login page, don't redirect
|
||||
}*/
|
||||
/* console.log('sssssssssssssssssssssssss')
|
||||
return next({ name: 'login' })*/
|
||||
/* return next({ name: 'login' })*/
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user