2024-02-13 21:24:07 -08:00
|
|
|
import { useMemo } from 'react';
|
|
|
|
|
2022-03-23 18:29:35 -07:00
|
|
|
import { getSettings } from 'soapbox/actions/settings';
|
2024-02-13 21:20:18 -08:00
|
|
|
import { settingsSchema } from 'soapbox/schemas/soapbox/settings';
|
2023-09-16 03:47:11 -07:00
|
|
|
|
|
|
|
import { useAppSelector } from './useAppSelector';
|
2022-03-23 18:29:35 -07:00
|
|
|
|
|
|
|
/** Get the user settings from the store */
|
2024-02-13 21:20:18 -08:00
|
|
|
export const useSettings = () => {
|
|
|
|
const data = useAppSelector((state) => getSettings(state));
|
2024-02-13 21:24:07 -08:00
|
|
|
return useMemo(() => settingsSchema.parse(data.toJS()), [data]);
|
2022-03-23 18:29:35 -07:00
|
|
|
};
|