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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user