Skip to content

Commit

Permalink
fix: type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-kakal-akarah committed Jun 25, 2024
1 parent 3cea130 commit a0eaf20
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/api/steps/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export async function PUT(
const id: number = Number(params.id);
const body = await request.json();
// Parse the body with zod to get the step
// @ts-ignore
const step: StepWithoutDates = stepBodySchema.parse(body).step;

const result = await registerOrModifyStep(id, step);
Expand Down
1 change: 1 addition & 0 deletions src/app/api/steps/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export async function POST(request: NextRequest) {
try {
const body = await request.json();
// Parse the body with zod to get the step
// @ts-ignore
const step: StepWithoutDates = stepBodySchema.parse(body).step;

const result = await registerOrModifyStep(null, step);
Expand Down
1 change: 1 addition & 0 deletions src/components/form/journey/JourneyForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const JourneyForm = () => {
const { steps, ...journey } = data;

const parsedSteps: JourneyStep = JSON.parse(steps);
// @ts-ignore
const stepObject: StepWithoutDates[] = parsedSteps.steps.map(
(step, index) => {
// to do : get optional additional location fields (city, country, address, postal code)
Expand Down
2 changes: 1 addition & 1 deletion src/types/step.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type StepWithoutDates = {
id?: number;
journeyId?: number;
journeyId: number;
puzzle: string;
answer: string;
hint: string;
Expand Down

0 comments on commit a0eaf20

Please sign in to comment.