summaryrefslogtreecommitdiff
path: root/apps/web/lib
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-08 00:06:53 -0800
committerFuwn <[email protected]>2026-02-08 00:06:53 -0800
commit2f3acb221af8cac85d3653ce8e7c7c30eb73ea77 (patch)
tree92ceab132fb4b6583cfaff46f5ac1adaed0a7d9e /apps/web/lib
parentfix: enforce same-origin on all service worker cache routes (diff)
downloadasa.news-2f3acb221af8cac85d3653ce8e7c7c30eb73ea77.tar.xz
asa.news-2f3acb221af8cac85d3653ce8e7c7c30eb73ea77.zip
feat: display folders above ungrouped feeds in sidebar, add delete-all-custom-feeds to danger zone
Diffstat (limited to 'apps/web/lib')
-rw-r--r--apps/web/lib/queries/use-custom-feed-mutations.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/web/lib/queries/use-custom-feed-mutations.ts b/apps/web/lib/queries/use-custom-feed-mutations.ts
index 0afa19c..66c2a19 100644
--- a/apps/web/lib/queries/use-custom-feed-mutations.ts
+++ b/apps/web/lib/queries/use-custom-feed-mutations.ts
@@ -98,6 +98,36 @@ export function useUpdateCustomFeed() {
})
}
+export function useDeleteAllCustomFeeds() {
+ const supabaseClient = createSupabaseBrowserClient()
+ const queryClient = useQueryClient()
+
+ return useMutation({
+ mutationFn: async () => {
+ const {
+ data: { user },
+ } = await supabaseClient.auth.getUser()
+
+ if (!user) throw new Error("not authenticated")
+
+ const { error } = await supabaseClient
+ .from("custom_feeds")
+ .delete()
+ .eq("user_id", user.id)
+
+ if (error) throw error
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: queryKeys.customFeeds.all })
+ queryClient.invalidateQueries({ queryKey: queryKeys.userProfile.all })
+ notify("all custom feeds deleted")
+ },
+ onError: (error: Error) => {
+ notify("failed to delete custom feeds: " + error.message)
+ },
+ })
+}
+
export function useDeleteCustomFeed() {
const supabaseClient = createSupabaseBrowserClient()
const queryClient = useQueryClient()