This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
forked from codesquad-members-2023/FineAnts-team-02
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#44 feat: Portfolio holding delete api 및 mutation 추가
- Loading branch information
1 parent
bb4ebb1
commit 857cad9
Showing
4 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
fe/src/api/portfolio/queries/usePortfolioHoldingAddMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
fe/src/api/portfolio/queries/usePortfolioHoldingDeleteMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { deletePortfolioHolding } from ".."; | ||
import { portfolioKeys } from "./queryKeys"; | ||
|
||
export default function usePortfolioHoldingAddMutation(portfolioId: number) { | ||
const queryClient = useQueryClient(); | ||
|
||
return useMutation({ | ||
mutationKey: portfolioKeys.deleteHolding(portfolioId).queryKey, | ||
mutationFn: deletePortfolioHolding, | ||
onSuccess: () => { | ||
// TODO: toast | ||
queryClient.invalidateQueries( | ||
portfolioKeys.details(portfolioId).queryKey | ||
); | ||
}, | ||
}); | ||
} |