Last active
February 10, 2022 02:32
-
-
Save adegbengaagoro/4c7d0ab1a96899abb2d5ac9444603cc2 to your computer and use it in GitHub Desktop.
Content Negotiation Example - payloadGeneratorForViewAndApi Function
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
function payloadGeneratorForViewAndApi(data: object | any[], viewTemplate: string, apiResponseMessage: string) { | |
const viewDataPayload = { | |
viewTemplate: viewTemplate, | |
outputData: { data } | |
} | |
const apiDataPayload = { | |
statusCode: 200, | |
statusMessage: 'Success', | |
responseMessage: apiResponseMessage, | |
outputData: { data } | |
} | |
return { viewDataPayload, apiDataPayload } | |
} | |
export default payloadGeneratorForViewAndApi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment