diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-05-24 12:59:43 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-05-24 12:59:43 +0000 |
| commit | 09652176f97f11bc06f4c9b57a448e14744eac12 (patch) | |
| tree | 5205f65bdef233328a7b4af010667c5b8c25f285 /packages/shared-react/hooks/users.ts | |
| parent | 5f3fe5d1a1ad0abd2890283cbff45086cbfa442e (diff) | |
| download | karakeep-09652176f97f11bc06f4c9b57a448e14744eac12.tar.zst | |
feat: Allow defaulting to reader mode when clicking on bookmarks. Fixes #662
Diffstat (limited to 'packages/shared-react/hooks/users.ts')
| -rw-r--r-- | packages/shared-react/hooks/users.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/shared-react/hooks/users.ts b/packages/shared-react/hooks/users.ts new file mode 100644 index 00000000..e896f8e4 --- /dev/null +++ b/packages/shared-react/hooks/users.ts @@ -0,0 +1,14 @@ +import { api } from "../trpc"; + +export function useUpdateUserSettings( + ...opts: Parameters<typeof api.users.updateSettings.useMutation> +) { + const apiUtils = api.useUtils(); + return api.users.updateSettings.useMutation({ + ...opts[0], + onSuccess: (res, req, meta) => { + apiUtils.users.settings.invalidate(); + return opts[0]?.onSuccess?.(res, req, meta); + }, + }); +} |
