feat(freight:backoffice): migrated smart-office user-management

This commit is contained in:
Michael Abebe
2026-05-26 12:50:40 +03:00
parent a8d26b73b8
commit b487d47055
9 changed files with 2350 additions and 15 deletions

View File

@@ -125,8 +125,15 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
mfaEmailRef.current = null;
},
logout: () => {
const preservedTheme = window.localStorage.getItem("edr-theme");
clearSessionCookies();
localStorage.clear();
window.localStorage.clear();
if (preservedTheme === "dark" || preservedTheme === "light") {
window.localStorage.setItem("edr-theme", preservedTheme);
}
setUser(null);
window.location.replace("/auth");
},

View File

@@ -1,11 +1,47 @@
interface LocaleText {
en?: string;
am?: string;
}
interface AuthRole {
id?: string;
key?: string;
}
interface AuthPermission {
id?: string;
key?: string;
}
interface AuthEmployeePosition {
id?: string;
employeePositionId?: string;
name?: LocaleText;
key?: string;
isDelegate?: boolean;
parentPositionId?: string | null;
permissions?: AuthPermission[];
}
interface AuthEmployeeRecord {
id?: string;
organizationId?: string;
unitId?: string;
name?: LocaleText;
positions?: AuthEmployeePosition[];
}
export interface AuthUser {
id?: string;
email?: string;
username?: string;
name?: {
en?: string;
am?: string;
};
phoneNumber?: string;
name?: LocaleText;
roles?: AuthRole[];
permissions?: AuthPermission[];
employee?: AuthEmployeeRecord[];
hasSetPassword?: boolean;
status?: string;
}
export interface AuthTokens {