mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 13:02:50 +00:00
test
This commit is contained in:
@@ -224,7 +224,7 @@ export function EndorsementQueuePage() {
|
||||
{/* Stats */}
|
||||
<SimpleGrid cols={{ base: 2, sm: 4 }} spacing="sm">
|
||||
{[
|
||||
{ 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 ? (
|
||||
<Box py="xl" ta="center">
|
||||
<ThemeIcon variant="light" color="gray" size={48} radius="xl" mx="auto" mb="sm"><IconStamp size={22} /></ThemeIcon>
|
||||
<ThemeIcon variant="light" color="gray" size={48} radius="xl" mx="auto" mb="sm"><IconRubberStamp size={22} /></ThemeIcon>
|
||||
<Text fz="sm" c="dimmed">No applications found</Text>
|
||||
</Box>
|
||||
) : (
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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 = unknown>(): 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: <T>(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: <T>(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 = unknown>(): 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: <T>(p: T) => localStorage.setItem(key('current-profile'), JSON.stringify(p)),
|
||||
removeProfile: () => localStorage.removeItem(key('current-profile')),
|
||||
setProfile: <T>(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: "/" });
|
||||
});
|
||||
};
|
||||
|
||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user