Skip to content

Commit

Permalink
remove Promise.await
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Oct 3, 2022
1 parent 80e1044 commit da371c1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions apps/meteor/app/api/server/v1/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ API.v1.addRoute(
}

const pollData = await getConfirmationPoll(deviceCode);
if (pollData) {
if ('successful' in pollData && pollData.successful) {
Promise.await(saveRegistrationData(pollData.payload));
}
return API.v1.success({ pollData });
if (!pollData) {
return API.v1.failure('Invalid query');
}

return API.v1.failure('Invalid query');
if ('successful' in pollData && pollData.successful) {
await saveRegistrationData(pollData.payload);
}

return API.v1.success({ pollData });
},
},
);
Expand Down

0 comments on commit da371c1

Please sign in to comment.