Skip to content

Commit

Permalink
Add create endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
SalmanAsh committed Aug 23, 2024
1 parent cba67e2 commit 08b8dcb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/api/agreementSignature.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {
type CreateArg,
type CreateResult,
type ListArg,
type ListResult,
type Model,
Expand Down Expand Up @@ -37,6 +39,15 @@ export type ListAgreementSignaturesResult = ListResult<
>
export type ListAgreementSignaturesArg = ListArg

export type CreateAgreementSignatureResult = CreateResult<
AgreementSignature,
"contributor" | "agreement_id" | "signed_at"
>
export type CreateAgreementSignatureArg = CreateArg<
AgreementSignature,
"contributor" | "agreement_id" | "signed_at"
>

const agreementSignatureApi = api.injectEndpoints({
endpoints: build => ({
retrieveAgreementSignature: build.query<
Expand All @@ -59,6 +70,17 @@ const agreementSignatureApi = api.injectEndpoints({
}),
providesTags: tagData("AgreementSignature", { includeListTag: true }),
}),
createAgreementSignature: build.mutation<
CreateAgreementSignatureResult,
CreateAgreementSignatureArg
>({
query: body => ({
url: agreementSignatureUrls.list,
method: "POST",
body,
}),
invalidatesTags: tagData("AgreementSignature", { includeListTag: true }),
}),
}),
})

Expand All @@ -68,4 +90,5 @@ export const {
useLazyRetrieveAgreementSignatureQuery,
useListAgreementSignaturesQuery,
useLazyListAgreementSignaturesQuery,
useCreateAgreementSignatureMutation,
} = agreementSignatureApi

0 comments on commit 08b8dcb

Please sign in to comment.