Commit 52c97ca6 by weiw

fix:同步内外网代码

parent b918f01c
......@@ -8,12 +8,15 @@ import { AuthProvider } from './auth/AuthContext'
import ToastWrapper from './components/ToastWrapper/ToastWrapper'
import { store } from './store'
const viteOutputObj = import.meta.env.VITE_OUTPUT_OBJ || 'open'
const basename = viteOutputObj === 'inner' ? '/sdream-fe' : '/sdream-ai'
const App: React.FC = () => {
return (
<Provider store={store}>
<ToastWrapper>
<AuthProvider>
<Router basename="/sdream-ai">
<Router basename={basename}>
<MainLayout>
<AppRoutes />
</MainLayout>
......
......@@ -93,7 +93,7 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
// eslint-disable-next-line react-refresh/only-export-components
export function useAuth(): AuthContextType {
const context = useContext(AuthContext)
if (context === undefined) {
if (context === null) {
throw new Error('useAuth must be used within an AuthProvider')
}
return context
......
......@@ -81,7 +81,7 @@ export function deepMerge<T extends object = object, S extends object = T>(targe
return target as any
const source = sources.shift()
if (source === undefined)
if (source === null)
return target as any
if (isMergableObject(target) && isMergableObject(source)) {
......@@ -131,7 +131,7 @@ export function deepMergeWithArray<T extends object = object, S extends object =
return target as any
const source = sources.shift()
if (source === undefined)
if (source === null)
return target as any
if (Array.isArray(target) && Array.isArray(source))
......@@ -198,7 +198,7 @@ export function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[
*/
export function clearUndefined<T extends object>(obj: T): T {
// @ts-expect-error
Object.keys(obj).forEach((key: string) => (obj[key] === undefined ? delete obj[key] : {}))
Object.keys(obj).forEach((key: string) => (obj[key] === null ? delete obj[key] : {}))
return obj
}
......
......@@ -130,7 +130,7 @@ export function unindent(str: TemplateStringsArray | string) {
if (whitespaceLines[idx])
return min
const indent = line.match(/^\s*/)?.[0].length
return indent === undefined ? min : Math.min(min, indent)
return indent === null ? min : Math.min(min, indent)
}, Number.POSITIVE_INFINITY)
let emptyLinesHead = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment