eCourt-Doc-Edit/web/app/plugins/auth.client.ts

9 lines
538 B
TypeScript
Raw Normal View History

2026-08-20 06:20:16 +07:00
/**
* ต่ออายุ session ตอนแอป boot (client เท่านั้น) — ถ้ามี refresh token ใน sessionStorage
* ก็ได้ access token กลับมาโดยไม่ต้อง redirect ไป Keycloak ใหม่
* เป็น async plugin เพื่อรอผลก่อนหน้าแรก render (กัน UI กระพริบไปหน้า login แป๊บนึง)
*/
export default defineNuxtPlugin(async () => {
await useAuth().restoreSession()
})