Created
February 5, 2023 21:43
-
-
Save jeffreyaven/f0e6c21b256a9fa72cb40d9f09084a8d to your computer and use it in GitHub Desktop.
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
const handler = async (event: Event) => { | |
... | |
try { | |
... | |
await logRequest(pageName, jwtId, event); | |
... | |
const data = ...; | |
return { | |
statusCode: 200, | |
body: JSON.stringify(data), | |
headers: ..., | |
}; | |
} catch (error) { | |
... | |
if (err.message === 'Unauthorized') { | |
statusCode = 401; | |
} | |
return { | |
statusCode: statusCode, | |
headers: ..., | |
}; | |
} | |
}; | |
export { handler }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment