Prevented unauthorized login

This commit is contained in:
Patrick Alvin Alcala 2025-10-08 09:30:59 +08:00
parent 69ec891f55
commit f18c80e847
2 changed files with 54 additions and 9 deletions

View file

@ -59,6 +59,7 @@ export default () => {
}
const checkDivision = async () => {
console.log('AAAA')
const building = await checkAccess('BUILDING ORDER OF PAYMENT')
setIsBuilding(building)
@ -70,6 +71,7 @@ export default () => {
}
const getListForPrinting = async () => {
console.log('BBB')
try {
const response = await ofetch(API + 'get-listopprinting-electrical', { parseResponse: JSON.parse })
setApplicationList(response.result)
@ -89,18 +91,27 @@ export default () => {
const nameStore = sessionStorage.getItem('name')
setEmployeeId(parseInt(idStore!))
setEmployeeName(nameStore!)
if (employeeId() === 0 || employeeId().toString() === 'NaN') {
removeEmployee()
navigate('/', { replace: true })
return false
}
return true
}
const logout = async () => {
removeEmployee()
navigate('/')
// console.log('yeah')
}
onMount(async () => {
checkLogged()
await checkDivision()
await getListForPrinting()
const logged = await checkLogged()
if (logged) {
await checkDivision()
await getListForPrinting()
}
})
return (