forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {createContext, useContext} from 'react'
2
3type AppConfigResponse = {
4 liveNow: {
5 allow: string[]
6 exceptions: {
7 did: string
8 allow: string[]
9 }[]
10 }
11}
12
13export const DEFAULT_APP_CONFIG_RESPONSE: AppConfigResponse = {
14 liveNow: {
15 allow: [],
16 exceptions: [],
17 },
18}
19
20const Context = createContext<AppConfigResponse>(DEFAULT_APP_CONFIG_RESPONSE)
21
22export function Provider({children}: React.PropsWithChildren<{}>) {
23 return (
24 <Context.Provider value={DEFAULT_APP_CONFIG_RESPONSE}>
25 {children}
26 </Context.Provider>
27 )
28}
29
30export async function prefetchAppConfig() {}
31
32export function useAppConfig() {
33 const ctx = useContext(Context)
34 if (!ctx) {
35 throw new Error('useAppConfig must be used within a Provider')
36 }
37 return ctx
38}