Skip to content

Commit

Permalink
fixed: return response for routes that don't
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesNg35 committed Feb 28, 2024
1 parent 4dacc5d commit 2485146
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
7 changes: 5 additions & 2 deletions apps/web/app/api/employee/working/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { NextResponse } from 'next/server';
export async function GET(req: Request) {
const res = new NextResponse();
const { $res, user, access_token, tenantId, organizationId } = await authenticatedGuard(req, res);
if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });

if (!user) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}

const { data } = await getOrganizationEmployees(access_token, tenantId, organizationId);

$res(data);
return $res(data);
}
2 changes: 1 addition & 1 deletion apps/web/app/api/invite/emails/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ export async function POST(req: Request) {
access_token
);

$res(data);
return $res(data);
}
2 changes: 1 addition & 1 deletion apps/web/app/api/invite/resend/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ export async function POST(req: Request) {
access_token
);

$res(data);
return $res(data);
}
2 changes: 1 addition & 1 deletion apps/web/app/api/invite/validate-by-code/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export async function POST(req: Request) {

const { data } = await verifyInviteCodeRequest(body);

NextResponse.json(data, { status: 200 });
return NextResponse.json(data, { status: 200 });
}
7 changes: 5 additions & 2 deletions apps/web/app/api/organization-projects/setting/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export async function PUT(req: Request, { params }: INextParams) {
}

const { $res, user, access_token, tenantId } = await authenticatedGuard(req, res);
if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });

if (!user) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}

const body = await req.json();

Expand All @@ -23,5 +26,5 @@ export async function PUT(req: Request, { params }: INextParams) {
tenantId
});

$res(response.data);
return $res(response.data);
}

0 comments on commit 2485146

Please sign in to comment.