mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
update git ignore file
This commit is contained in:
parent
7560ea1426
commit
e7f3bfcd1f
2 changed files with 28 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
.flashrank_cache*
|
.flashrank_cache*
|
||||||
podcasts/
|
./surfsense_backend/podcasts/
|
||||||
.env
|
.env
|
||||||
node_modules/
|
node_modules/
|
||||||
.ruff_cache/
|
.ruff_cache/
|
||||||
27
surfsense_web/atoms/podcasts/podcast-mutation.atoms.ts
Normal file
27
surfsense_web/atoms/podcasts/podcast-mutation.atoms.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { atomWithMutation } from "jotai-tanstack-query";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import { activeSearchSpaceIdAtom } from "@/atoms/seach-spaces/seach-space-queries.atom";
|
||||||
|
import type { DeletePodcastRequest, Podcast } from "@/contracts/types/podcast.types";
|
||||||
|
import { podcastsApiService } from "@/lib/apis/podcasts-api.service";
|
||||||
|
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
||||||
|
import { queryClient } from "@/lib/query-client/client";
|
||||||
|
|
||||||
|
export const deletePodcastMutationAtom = atomWithMutation((get) => {
|
||||||
|
const searchSpaceId = get(activeSearchSpaceIdAtom);
|
||||||
|
const authToken = localStorage.getItem("surfsense_bearer_token");
|
||||||
|
|
||||||
|
return {
|
||||||
|
mutationKey: cacheKeys.podcasts(),
|
||||||
|
enabled: !!searchSpaceId && !!authToken,
|
||||||
|
mutationFn: async (request: DeletePodcastRequest) => {
|
||||||
|
return podcastsApiService.deletePodcast(request);
|
||||||
|
},
|
||||||
|
|
||||||
|
onSuccess: (_, request: DeletePodcastRequest) => {
|
||||||
|
toast.success("Podcast deleted successfully");
|
||||||
|
queryClient.setQueryData(cacheKeys.podcasts(), (oldData: Podcast[]) => {
|
||||||
|
return oldData.filter((podcast) => podcast.id !== request.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue