2023-10-20 16:18:30 +00:00
|
|
|
import { AppRouterOutput, trpc } from '../api/trpc';
|
|
|
|
|
|
|
|
const defaultGlobalConfig: AppRouterOutput['global']['config'] = {
|
|
|
|
allowRegister: false,
|
2024-02-17 03:45:11 +00:00
|
|
|
alphaMode: false,
|
2023-10-20 16:18:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch settings from server
|
|
|
|
*/
|
|
|
|
export function useGlobalConfig(): AppRouterOutput['global']['config'] {
|
|
|
|
const { data = defaultGlobalConfig } = trpc.global.config.useQuery(
|
|
|
|
undefined,
|
|
|
|
{
|
|
|
|
staleTime: 1000 * 60 * 60 * 1, // 1 hour
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|