diff --git a/commafeed-client/src/components/settings/CustomCss.tsx b/commafeed-client/src/components/settings/CustomCss.tsx index 13097855..1d9e9e6a 100644 --- a/commafeed-client/src/components/settings/CustomCss.tsx +++ b/commafeed-client/src/components/settings/CustomCss.tsx @@ -20,11 +20,17 @@ export function CustomCss() { const form = useForm() const { setValues } = form - const saveCustomCss = useAsyncCallback(client.user.saveSettings, { - onSuccess: () => { - window.location.reload() + const saveCustomCss = useAsyncCallback( + async (d: FormData) => { + if (!settings) return + await client.user.saveSettings({ ...settings, customCss: d.customCss }) }, - }) + { + onSuccess: () => { + window.location.reload() + }, + } + ) useEffect(() => { if (!customCss) return @@ -34,17 +40,7 @@ export function CustomCss() { }, [setValues, customCss]) return ( -
{ - if (!settings) return - saveCustomCss - .execute({ - ...settings, - customCss: data.customCss, - }) - .then(() => window.location.reload()) - })} - > +