mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-04 20:28:12 +08:00
28 lines
592 B
TypeScript
28 lines
592 B
TypeScript
'use client'
|
|
|
|
import { createContext, useContext } from 'use-context-selector'
|
|
import type { App } from '@/types/app'
|
|
import type { UserProfileResponse } from '@/models/common'
|
|
|
|
export type AppContextValue = {
|
|
apps: App[]
|
|
mutateApps: () => void
|
|
userProfile: UserProfileResponse
|
|
mutateUserProfile: () => void
|
|
}
|
|
|
|
const AppContext = createContext<AppContextValue>({
|
|
apps: [],
|
|
mutateApps: () => { },
|
|
userProfile: {
|
|
id: '',
|
|
name: '',
|
|
email: '',
|
|
},
|
|
mutateUserProfile: () => { },
|
|
})
|
|
|
|
export const useAppContext = () => useContext(AppContext)
|
|
|
|
export default AppContext
|