Taking the example 'todo' app as an example. How do I create a page to show a single Task? I've given it a go but I've hit a dead end! Using the example from https://wasp-lang.dev/docs/tutorial/pages I have the following but have no idea how to use RouteComponentProps.
In
main.wasp
main.wasp
I have:
route TaskRoute { path: "/tasks/:taskId", to: TaskPage }page TaskPage { authRequired: true, component: import TaskPage from "@src/tasks/TaskPage",}
route TaskRoute { path: "/tasks/:taskId", to: TaskPage }page TaskPage { authRequired: true, component: import TaskPage from "@src/tasks/TaskPage",}
in
operations.ts
operations.ts
I have:
import { RouteComponentProps } from 'react-router-dom';import { Task } from 'wasp/entities';import { type GetTask } from 'wasp/server/operations';export const getTask: GetTask<void, Task[]> = async (args, context) => { const task = await context.entities.Task.findUnique({ where: { id: taskId }, });};
import { RouteComponentProps } from 'react-router-dom';import { Task } from 'wasp/entities';import { type GetTask } from 'wasp/server/operations';export const getTask: GetTask<void, Task[]> = async (args, context) => { const task = await context.entities.Task.findUnique({ where: { id: taskId }, });};