Improve authentication error handling and update dependencies

- Add try-catch block for authentication check in TicketForm
- Handle authentication errors gracefully with proper error logging
- Update caniuse-lite dependency to latest version

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Clas Wen 2025-10-10 19:11:15 +08:00
parent f235cd5f1b
commit 42df93b9e6
2 changed files with 18 additions and 17 deletions

View file

@ -2966,11 +2966,8 @@ packages:
resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==}
engines: {node: '>=16'}
caniuse-lite@1.0.30001715:
resolution: {integrity: sha512-7ptkFGMm2OAOgvZpwgA4yjQ5SQbrNVGdRjzH0pBdy1Fasvcr+KAeECmbCAECzTuDuoX0FCY8KzUxjf9+9kfZEw==}
caniuse-lite@1.0.30001735:
resolution: {integrity: sha512-EV/laoX7Wq2J9TQlyIXRxTJqIw4sxfXS4OYgudGxBYRuTv0q7AM6yMEpU/Vo1I94thg9U6EZ2NfZx9GJq83u7w==}
caniuse-lite@1.0.30001747:
resolution: {integrity: sha512-mzFa2DGIhuc5490Nd/G31xN1pnBnYMadtkyTjefPI7wzypqgCEpeWu9bJr0OnDsyKrW75zA9ZAt7pbQFmwLsQg==}
ccount@2.0.1:
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
@ -9515,7 +9512,7 @@ snapshots:
autoprefixer@10.4.21(postcss@8.5.3):
dependencies:
browserslist: 4.24.4
caniuse-lite: 1.0.30001715
caniuse-lite: 1.0.30001747
fraction.js: 4.3.7
normalize-range: 0.1.2
picocolors: 1.1.1
@ -9564,14 +9561,14 @@ snapshots:
browserslist@4.24.4:
dependencies:
caniuse-lite: 1.0.30001715
caniuse-lite: 1.0.30001747
electron-to-chromium: 1.5.141
node-releases: 2.0.19
update-browserslist-db: 1.1.3(browserslist@4.24.4)
browserslist@4.25.3:
dependencies:
caniuse-lite: 1.0.30001735
caniuse-lite: 1.0.30001747
electron-to-chromium: 1.5.207
node-releases: 2.0.19
update-browserslist-db: 1.1.3(browserslist@4.25.3)
@ -9631,9 +9628,7 @@ snapshots:
camelcase@8.0.0: {}
caniuse-lite@1.0.30001715: {}
caniuse-lite@1.0.30001735: {}
caniuse-lite@1.0.30001747: {}
ccount@2.0.1: {}

View file

@ -145,13 +145,19 @@ export default function App() {
useEffect(() => {
const check = async () => {
const createRepairPath = "/repair/create-ticket"
const authenticated = await makeLogtoClient().isAuthenticated()
if (!authenticated) {
window.location.href = `/repair/login-hint?redirectUrl=${createRepairPath}`
return
try {
const authenticated = await makeLogtoClient().isAuthenticated()
if (!authenticated) {
window.location.href = `/repair/login-hint?redirectUrl=${createRepairPath}`
return
}
const res = await makeLogtoClient().getIdTokenClaims()
setUserInfo(res)
}
catch (error) {
console.error("Error checking authentication:", error)
window.location.href = `/repair/login-hint?redirectUrl=${createRepairPath}`
}
const res = await makeLogtoClient().getIdTokenClaims()
setUserInfo(res)
}
check()
}, [])