Skip to content

Commit

Permalink
clean req -> request in route files
Browse files Browse the repository at this point in the history
  • Loading branch information
demanguillaume committed May 23, 2024
1 parent 6a19b7b commit a5d5524
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
38 changes: 19 additions & 19 deletions src/app/api/auth/register/route.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { NextRequest, NextResponse } from "next/server";
import { register } from "@/services/userService";
import {RegisterUser} from "@/types/register";
import { RegisterUser } from "@/types/register";

async function handler(req: NextRequest): Promise<NextResponse> {
const data = await req.json();
async function handler(request: NextRequest): Promise<NextResponse> {
const data = await request.json();

try {
const userData: RegisterUser = {
email: data.email,
password: data.password,
username: data.username,
name: data.name,
lastName: data.lastName,
dateOfBirth: data.dateOfBirth,
};
try {
const userData: RegisterUser = {
email: data.email,
password: data.password,
username: data.username,
name: data.name,
lastName: data.lastName,
dateOfBirth: data.dateOfBirth,
};

const newUser = await register(userData);
return NextResponse.json({ user: newUser }, { status: 201 });
} catch (error: any) {
console.log(error.message)
return NextResponse.json({ message: error.message }, { status: 500 });
}
const newUser = await register(userData);
return NextResponse.json({ user: newUser }, { status: 201 });
} catch (error: any) {
console.log(error.message);
return NextResponse.json({ message: error.message }, { status: 500 });
}
}

export { handler as POST };
export { handler as POST };
2 changes: 1 addition & 1 deletion src/app/api/events/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NextRequest, NextResponse } from "next/server";

// GET /api/events/[id] : get an event by id with user events
export async function GET(
req: NextRequest,
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/journeys/[id]/withComments/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from "next/server";

// GET /api/journeys/[id]/withComments : get a journey by id with associated comments
export async function GET(
req: NextRequest,
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/journeys/[id]/withSteps/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from "next/server";

// GET /api/journeys/[id]/withSteps : get a journey by id with associated steps
export async function GET(
req: NextRequest,
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/steps/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NextRequest, NextResponse } from "next/server";

// GET /api/steps/[id] : get a step by id
export async function GET(
req: NextRequest,
request: NextRequest,
{ params }: { params: { id: string } }
) {
try {
Expand Down

0 comments on commit a5d5524

Please sign in to comment.