fix(frontend): resolve build errors

- Fix undefined loadHistory in App.tsx
- Use type-only import for Theme in theme-provider.tsx
- Update auth.ts to import Theme from theme-context
This commit is contained in:
Yunxiao Xu
2026-02-21 08:29:48 -08:00
parent 5d8ecdc8e9
commit 7be24d8884
3 changed files with 15 additions and 32 deletions

View File

@@ -1,16 +1,6 @@
import { createContext, useContext, useEffect, useState, useCallback, useMemo } from "react"
import { useEffect, useState, useCallback, useMemo } from "react"
import { AuthService } from "@/services/auth"
export type Theme = "light" | "dark"
interface ThemeContextType {
theme: Theme
setTheme: (theme: Theme) => void
setThemeLocal: (theme: Theme) => void
toggleTheme: () => void
}
const ThemeContext = createContext<ThemeContextType | undefined>(undefined)
import { type Theme, ThemeContext } from "./theme-context"
export function ThemeProvider({
children,
@@ -61,11 +51,3 @@ export function ThemeProvider({
</ThemeContext.Provider>
)
}
export const useTheme = () => {
const context = useContext(ThemeContext)
if (context === undefined) {
throw new Error("useTheme must be used within a ThemeProvider")
}
return context
}