2024-05-17 20:21:20 +08:00
|
|
|
import { useReactiveVar } from '@apollo/client';
|
|
|
|
import { SETTINGS } from '../enums';
|
2024-05-29 21:26:11 +08:00
|
|
|
import { getSettingsSingletonInstance } from '..';
|
2024-05-17 20:21:20 +08:00
|
|
|
|
|
|
|
const useSettings = (setting: typeof SETTINGS[keyof typeof SETTINGS]) => {
|
|
|
|
const prop = `${setting}Var`;
|
|
|
|
// @ts-ignore JS code
|
2024-05-29 21:26:11 +08:00
|
|
|
const Settings = getSettingsSingletonInstance();
|
2024-05-17 20:21:20 +08:00
|
|
|
const variable = Settings[prop];
|
|
|
|
return useReactiveVar(variable);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default useSettings;
|