-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ohcnetwork:develop' into develop
- Loading branch information
Showing
31 changed files
with
665 additions
and
465 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { callApi } from "@/Utils/request/query"; | ||
import { APICallOptions, Route } from "@/Utils/request/types"; | ||
|
||
/** | ||
* Creates a TanStack Query compatible mutation function. | ||
* | ||
* Example: | ||
* ```tsx | ||
* const { mutate: createPrescription, isPending } = useMutation({ | ||
* mutationFn: mutate(MedicineRoutes.createPrescription, { | ||
* pathParams: { consultationId }, | ||
* }), | ||
* onSuccess: () => { | ||
* toast.success(t("medication_request_prescribed")); | ||
* }, | ||
* }); | ||
* ``` | ||
*/ | ||
export default function mutate<TData, TBody>( | ||
route: Route<TData, TBody>, | ||
options?: APICallOptions<TBody>, | ||
) { | ||
return (variables: TBody) => { | ||
return callApi(route, { ...options, body: variables }); | ||
}; | ||
} |
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
Oops, something went wrong.