Created
April 13, 2022 17:28
-
-
Save jtomchak/df5ca4098da8dfdb5aeecdbe29287481 to your computer and use it in GitHub Desktop.
DocuSign Snippet
This file contains hidden or 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
export const useEnvelopeDetailsQuery = (query?: QueryParams) => { | |
const fetchEnvelopeWithCredentials = | |
useFetchWithCredentials<EnvelopeResponse>(); | |
const { queryString } = serializeQueryParams(query); | |
const { data: envelopeResponse, isLoading } = useQuery< | |
EnvelopeResponse, | |
ErrorDetails | |
>( | |
['envelopeDetails', queryString], | |
() => | |
fetchEnvelopeWithCredentials( | |
`${apis.API_URL}/envelopes/details?${queryString}`, | |
), | |
{ initialData }, | |
); | |
const envelope = envelopeResponse?.data!; | |
const isEnvelopeDetailsLoading = isLoading || envelope === null; | |
const isEnvelopeEmpty = envelope === undefined; | |
return { | |
envelope, | |
isEnvelopeDetailsLoading, | |
isEnvelopeEmpty, | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment