Fixed destructure error.

This commit is contained in:
Mike Cao 2023-07-20 23:12:15 -07:00
parent 25feee662b
commit 39562d4a64

View File

@ -116,7 +116,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
}; };
function validateBody(res: NextApiResponse, { type, payload }: CollectRequestBody) { function validateBody(res: NextApiResponse, { type, payload }: CollectRequestBody) {
const { data } = payload; const { data } = payload || {};
// Validate type // Validate type
if (type !== COLLECTION_TYPE.event && type !== COLLECTION_TYPE.identify) { if (type !== COLLECTION_TYPE.event && type !== COLLECTION_TYPE.identify) {