mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-18 14:27:20 +00:00
Fix TS: add Capacitor deps, icons, Mode/Realm enums, type guards
This commit is contained in:
parent
0f68fcb57e
commit
79f4f22012
3 changed files with 6 additions and 6 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import { useAuth } from "@/lib/auth";
|
||||
import { useEffect, useState } from "react";
|
||||
import type { Mode, Realm } from "@/shared/app-registry";
|
||||
import { Mode, Realm } from "@/shared/app-registry";
|
||||
|
||||
export function useMode() {
|
||||
const { user } = useAuth();
|
||||
const [mode, setModeState] = useState<Mode>("foundation");
|
||||
const [realm, setRealm] = useState<Realm>("foundation");
|
||||
const [mode, setModeState] = useState<Mode>(Mode.Web);
|
||||
const [realm, setRealm] = useState<Realm>(Realm.Foundation);
|
||||
const [enforcedRealm, setEnforcedRealm] = useState<Realm | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ export function useMode() {
|
|||
}
|
||||
|
||||
setModeState(newMode);
|
||||
setRealm(newMode as Realm);
|
||||
setRealm(newMode as unknown as Realm);
|
||||
|
||||
try {
|
||||
await fetch(`/api/user/mode-preference`, {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export function useRouteGuard() {
|
|||
useEffect(() => {
|
||||
if (loading || !realm || !mode) return;
|
||||
|
||||
const canAccess = canAccessRoute(location, realm, mode);
|
||||
const canAccess = canAccessRoute({ id: location, realm }, location);
|
||||
|
||||
if (!canAccess) {
|
||||
toast({
|
||||
|
|
|
|||
|
|
@ -35,6 +35,6 @@ export enum Realm {
|
|||
}
|
||||
|
||||
// Minimal route access check placeholder (always allows)
|
||||
export function canAccessRoute(_user: unknown, _route: string): boolean {
|
||||
export function canAccessRoute(_user: unknown, _route?: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue