Skip to content

Commit

Permalink
cleaner solution
Browse files Browse the repository at this point in the history
  • Loading branch information
timolegros committed Jun 25, 2024
1 parent 7134cc0 commit 2ae1b70
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/commonwealth/server/routes/getNewProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ const getNewProfile = async (
) => {
const { profileId } = req.query;

let profile: ProfileInstance;

if (profileId) {
const parsedInt = parseInt(profileId);
if (isNaN(parsedInt) || parsedInt !== parseFloat(profileId)) {
throw new AppError('Invalid profile id');
}
}

let profile: ProfileInstance;

if (profileId) {
// @ts-expect-error StrictNullChecks
profile = await models.Profile.findOne({
where: {
Expand Down

0 comments on commit 2ae1b70

Please sign in to comment.