diff --git a/apps/backoffice/src/app/features/endorsement/pages/EndorsementQueuePage.tsx b/apps/backoffice/src/app/features/endorsement/pages/EndorsementQueuePage.tsx index a3c9ccef3..c4270e8ca 100644 --- a/apps/backoffice/src/app/features/endorsement/pages/EndorsementQueuePage.tsx +++ b/apps/backoffice/src/app/features/endorsement/pages/EndorsementQueuePage.tsx @@ -224,7 +224,7 @@ export function EndorsementQueuePage() { {/* Stats */} {[ - { label: 'Total Applications', value: stats.total, color: 'blue', icon: IconStamp }, + { label: 'Total Applications', value: stats.total, color: 'blue', icon: IconRubberStamp }, { label: 'Awaiting Review', value: stats.pending, color: 'yellow', icon: IconClock }, { label: 'Endorsed', value: stats.endorsed, color: 'teal', icon: IconCircleCheck }, { label: 'Rejected', value: stats.rejected, color: 'red', icon: IconShieldCheck }, @@ -264,7 +264,7 @@ export function EndorsementQueuePage() { {filtered.length === 0 ? ( - + No applications found ) : ( diff --git a/apps/backoffice/src/app/layouts/BackofficeLayout.tsx b/apps/backoffice/src/app/layouts/BackofficeLayout.tsx index 81c6e9840..00130ef27 100644 --- a/apps/backoffice/src/app/layouts/BackofficeLayout.tsx +++ b/apps/backoffice/src/app/layouts/BackofficeLayout.tsx @@ -34,7 +34,7 @@ const NAV_ITEMS: NavItem[] = [ { to: '/coc-queue', label: 'nav.cocQueue', icon: IconShieldCheck }, { to: '/endorsement-queue', label: 'nav.endorsementQueue', icon: IconRubberStamp }, { to: '/seafarer-registry', label: 'nav.seafarerRegistry', icon: IconUsers }, - { to: '/applications', label: 'nav.applications', icon: IconFileDescription }, + // { to: '/applications', label: 'nav.applications', icon: IconFileDescription }, { to: '/payment-config', label: 'nav.paymentConfig', icon: IconCreditCard }, { to: '/analytics', label: 'nav.analytics', icon: IconChartBar }, { to: '/medical-verification', label: 'nav.medicalVerification', icon: IconHeart }, diff --git a/libs/auth/src/lib/utils/auth-storage.ts b/libs/auth/src/lib/utils/auth-storage.ts index 22fc1757f..588191ab5 100644 --- a/libs/auth/src/lib/utils/auth-storage.ts +++ b/libs/auth/src/lib/utils/auth-storage.ts @@ -1,4 +1,6 @@ -let _prefix = 'ema-auth'; +import Cookies from "js-cookie"; + +let _prefix = "ema-auth"; export function configureAuthStorage(prefix: string) { _prefix = prefix; @@ -9,34 +11,54 @@ function key(k: string) { } export const authStorage = { - getToken: () => localStorage.getItem(key('auth-token')) ?? undefined, - setToken: (token: string) => localStorage.setItem(key('auth-token'), token), - getRefreshToken: () => localStorage.getItem(key('refresh-token')) ?? undefined, - setRefreshToken: (t: string) => localStorage.setItem(key('refresh-token'), t), + getToken: () => localStorage.getItem(key("auth-token")) ?? undefined, + setToken: (token: string) => localStorage.setItem(key("auth-token"), token), + getRefreshToken: () => + localStorage.getItem(key("refresh-token")) ?? undefined, + setRefreshToken: (t: string) => localStorage.setItem(key("refresh-token"), t), getUser: (): T | null => { try { - return JSON.parse(localStorage.getItem(key('auth-user')) ?? 'null') as T | null; + return JSON.parse( + localStorage.getItem(key("auth-user")) ?? "null", + ) as T | null; } catch { return null; } }, - setUser: (u: T) => localStorage.setItem(key('auth-user'), JSON.stringify(u)), - getProfileId: () => localStorage.getItem(key('profile-id')) ?? undefined, - setProfileId: (id: string) => localStorage.setItem(key('profile-id'), id), + setUser: (u: T) => + localStorage.setItem(key("auth-user"), JSON.stringify(u)), + getProfileId: () => localStorage.getItem(key("profile-id")) ?? undefined, + setProfileId: (id: string) => localStorage.setItem(key("profile-id"), id), getProfile: (): T | null => { try { - return JSON.parse(localStorage.getItem(key('current-profile')) ?? 'null') as T | null; + return JSON.parse( + localStorage.getItem(key("current-profile")) ?? "null", + ) as T | null; } catch { return null; } }, - setProfile: (p: T) => localStorage.setItem(key('current-profile'), JSON.stringify(p)), - removeProfile: () => localStorage.removeItem(key('current-profile')), + setProfile: (p: T) => + localStorage.setItem(key("current-profile"), JSON.stringify(p)), + removeProfile: () => localStorage.removeItem(key("current-profile")), clear: () => { - [key('auth-token'), key('refresh-token'), key('auth-user'), key('profile-id'), key('current-profile')].forEach((k) => - localStorage.removeItem(k), - ); + [ + key("auth-token"), + key("refresh-token"), + key("auth-user"), + key("profile-id"), + key("current-profile"), + ].forEach((k) => localStorage.removeItem(k)); document.cookie = - 'auth-token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC; SameSite=Lax'; + "auth-token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC; SameSite=Lax"; }, }; + +export const clearAllCookies = () => { + const cookies = Cookies.get(); + + Object.keys(cookies).forEach((name) => { + Cookies.remove(name); + Cookies.remove(name, { path: "/" }); + }); +}; diff --git a/package-lock.json b/package-lock.json index 49e6d330a..3ad395a6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "date-fns": "^4.1.0", "dayjs": "^1.11.20", "i18next": "^25.6.0", + "js-cookie": "^3.0.8", "react": "^19.0.0", "react-dom": "^19.0.0", "react-hook-form": "^7.71.2", @@ -42,6 +43,7 @@ "@nx/react": "^22.5.4", "@nx/vite": "^22.5.4", "@nx/vitest": "^22.5.4", + "@types/js-cookie": "^3.0.6", "@types/node": "^22.0.0", "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", @@ -9146,6 +9148,13 @@ "@types/sizzle": "*" } }, + "node_modules/@types/js-cookie": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz", + "integrity": "sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", diff --git a/package.json b/package.json index 7d291d660..45da06add 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "date-fns": "^4.1.0", "dayjs": "^1.11.20", "i18next": "^25.6.0", + "js-cookie": "^3.0.8", "react": "^19.0.0", "react-dom": "^19.0.0", "react-hook-form": "^7.71.2", @@ -47,6 +48,7 @@ "@nx/react": "^22.5.4", "@nx/vite": "^22.5.4", "@nx/vitest": "^22.5.4", + "@types/js-cookie": "^3.0.6", "@types/node": "^22.0.0", "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0",