diff options
| author | Fuwn <[email protected]> | 2026-02-08 00:18:30 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-08 00:18:30 -0800 |
| commit | e6cfa9ccc0b51e34690c3db38216daa659ae147f (patch) | |
| tree | d8b0a471fa86e08034ed412da1e163fae2263685 /apps/web/lib | |
| parent | feat: add option to show favicons next to feed names in entry list (diff) | |
| download | asa.news-e6cfa9ccc0b51e34690c3db38216daa659ae147f.tar.xz asa.news-e6cfa9ccc0b51e34690c3db38216daa659ae147f.zip | |
feat: add feed URL editing in subscription settings, fix notification badge styling and HTML entity decoding
Diffstat (limited to 'apps/web/lib')
| -rw-r--r-- | apps/web/lib/queries/use-subscription-mutations.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/web/lib/queries/use-subscription-mutations.ts b/apps/web/lib/queries/use-subscription-mutations.ts index 3162d96..7bf9d07 100644 --- a/apps/web/lib/queries/use-subscription-mutations.ts +++ b/apps/web/lib/queries/use-subscription-mutations.ts @@ -131,6 +131,35 @@ export function useUnsubscribeAll() { }) } +export function useUpdateFeedUrl() { + const supabaseClient = createSupabaseBrowserClient() + const queryClient = useQueryClient() + + return useMutation({ + mutationFn: async ({ + feedIdentifier, + feedUrl, + }: { + feedIdentifier: string + feedUrl: string + }) => { + const { error } = await supabaseClient.rpc("update_feed_url", { + target_feed_id: feedIdentifier, + new_url: feedUrl, + }) + + if (error) throw error + }, + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: queryKeys.subscriptions.all }) + notify("feed url updated") + }, + onError: (error: Error) => { + notify("failed to update feed url: " + error.message) + }, + }) +} + export function useRequestFeedRefresh() { const supabaseClient = createSupabaseBrowserClient() |