feat: add guest mode, bug fixes, and self-hosted config

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
M1ngdaXie
2026-03-15 09:45:17 +00:00
co-authored by Claude Sonnet 4.6
parent 763575f284
commit 9c19769eb0
15 changed files with 187 additions and 36 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import { createContext, useContext, useState, useEffect } from 'react';
import { createContext, useContext, useState, useEffect, useCallback } from 'react';
import type { ReactNode } from 'react';
import type { User, AuthContextType } from '../types/auth';
import { authApi } from '../api/auth';
@@ -40,7 +40,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
initAuth();
}, []);
const login = async (newToken: string) => {
const login = useCallback(async (newToken: string) => {
try {
setLoading(true);
setError(null);
@@ -60,7 +60,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
} finally {
setLoading(false);
}
};
}, []);
const logout = () => {
localStorage.removeItem('auth_token');