fix and update
This commit is contained in:
@@ -40,7 +40,7 @@ export function FamilySidebarPanel() {
|
||||
}
|
||||
fetchChatRooms(group.id, token)
|
||||
.then((response) => setRooms(response.rooms ?? []))
|
||||
.catch(() => setRooms([]));
|
||||
.catch(() => undefined);
|
||||
}, [group?.id, token]);
|
||||
|
||||
const roomByPeerUserId = useMemo(() => {
|
||||
|
||||
@@ -56,6 +56,7 @@ interface AuthContextValue {
|
||||
verifyTotpLogin: (totpChallengeToken: string, code: string) => Promise<AuthTokens>;
|
||||
completePin: (sessionId: string, pin: string) => Promise<void>;
|
||||
applyLoginAuth: (auth: AuthTokens) => Promise<AuthTokens>;
|
||||
applyUserPatch: (patch: Partial<PublicUser>) => void;
|
||||
register: (data: { displayName: string; login: string; password: string }) => Promise<void>;
|
||||
refreshProfile: () => Promise<void>;
|
||||
logout: () => void;
|
||||
@@ -273,6 +274,15 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
router.push('/auth/login');
|
||||
}, [clearPinLock, router]);
|
||||
|
||||
const applyUserPatch = React.useCallback((patch: Partial<PublicUser>) => {
|
||||
setUser((current) => {
|
||||
if (!current) return current;
|
||||
const next = { ...current, ...patch };
|
||||
cacheUserProfile(next);
|
||||
return next;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const refreshProfile = React.useCallback(async () => {
|
||||
if (refreshInFlightRef.current) {
|
||||
return refreshInFlightRef.current;
|
||||
@@ -691,6 +701,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
verifyTotpLogin,
|
||||
completePin,
|
||||
applyLoginAuth,
|
||||
applyUserPatch,
|
||||
register,
|
||||
refreshProfile,
|
||||
logout
|
||||
|
||||
Reference in New Issue
Block a user