mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-27 01:37:21 +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 { useAuth } from "@/lib/auth";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import type { Mode, Realm } from "@/shared/app-registry";
|
import { Mode, Realm } from "@/shared/app-registry";
|
||||||
|
|
||||||
export function useMode() {
|
export function useMode() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const [mode, setModeState] = useState<Mode>("foundation");
|
const [mode, setModeState] = useState<Mode>(Mode.Web);
|
||||||
const [realm, setRealm] = useState<Realm>("foundation");
|
const [realm, setRealm] = useState<Realm>(Realm.Foundation);
|
||||||
const [enforcedRealm, setEnforcedRealm] = useState<Realm | null>(null);
|
const [enforcedRealm, setEnforcedRealm] = useState<Realm | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ export function useMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setModeState(newMode);
|
setModeState(newMode);
|
||||||
setRealm(newMode as Realm);
|
setRealm(newMode as unknown as Realm);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fetch(`/api/user/mode-preference`, {
|
await fetch(`/api/user/mode-preference`, {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export function useRouteGuard() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading || !realm || !mode) return;
|
if (loading || !realm || !mode) return;
|
||||||
|
|
||||||
const canAccess = canAccessRoute(location, realm, mode);
|
const canAccess = canAccessRoute({ id: location, realm }, location);
|
||||||
|
|
||||||
if (!canAccess) {
|
if (!canAccess) {
|
||||||
toast({
|
toast({
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,6 @@ export enum Realm {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minimal route access check placeholder (always allows)
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue