-
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.
B 2764 add mutation to cancel application (#639)
- Loading branch information
1 parent
8705e71
commit 57a16d3
Showing
9 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
core/application/react-query-adapter/application/client/index.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./use-accept-application"; | ||
export * from "./use-get-application-by-id"; | ||
export * from "./use-patch-application"; | ||
export * from "./use-delete-application"; |
30 changes: 30 additions & 0 deletions
30
core/application/react-query-adapter/application/client/use-delete-application.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,30 @@ | ||
import { useMutation } from "@tanstack/react-query"; | ||
|
||
import { | ||
UseMutationFacadeParams, | ||
useMutationAdapter, | ||
} from "@/core/application/react-query-adapter/helpers/use-mutation-adapter"; | ||
import { bootstrap } from "@/core/bootstrap"; | ||
import { DeleteApplicationBody } from "@/core/domain/application/application-contract.types"; | ||
import { ApplicationFacadePort } from "@/core/domain/application/input/application-facade-port"; | ||
|
||
export function useDeleteApplication({ | ||
pathParams, | ||
options, | ||
}: UseMutationFacadeParams<ApplicationFacadePort["deleteApplication"], undefined, never, DeleteApplicationBody>) { | ||
const applicationStoragePort = bootstrap.getApplicationStoragePortForClient(); | ||
|
||
return useMutation( | ||
useMutationAdapter({ | ||
...applicationStoragePort.deleteApplication({ pathParams }), | ||
options: { | ||
...options, | ||
onSuccess: async (data, variables, context) => { | ||
// TODO invalidate application list query | ||
|
||
options?.onSuccess?.(data, variables, context); | ||
}, | ||
}, | ||
}) | ||
); | ||
} |
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
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
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
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