chad.bohlmann
chad.bohlmann
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
It complains of an error on a post to localhost port 3001. I don't know what would be running there. This client is a different machine (192.168.4.68) than the server (192.168.4.1).
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
No description
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
Here's the client side in web browser:
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
export const createTask = async (args, context) => { return context.entities.Task.create({ data: { description: args.description }, }) }
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
and actions.js:
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
await createTask({ description }) } catch (err) { window.alert ('Error: ' + err.message) } } return ( <form onSubmit={handleSubmit}> <input name="description" type="text" defaultValue="" /> <input type="submit" value="Create task" /> </form> ) }
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
import { createTask, getTasks, useQuery } from 'wasp/client/operations' export const MainPage = () => { const { data: tasks, isLoading, error } = useQuery(getTasks) return ( <div> {tasks && <TasksList tasks={tasks} />} {isLoading && 'Loading...'} {error && 'Error: ' + error} </div> ) } const TaskView = ({ task }) => { return ( <div> <input type="checkbox" id={String(task.id)} checked={task.isDone} /> {task.description} </div> ) } const TasksList = ({ tasks }) => { if (!tasks?.length) return <div>No tasks</div> return ( <div> {tasks.map((task, idx) => ( <TaskView task={task} key={idx} /> ))} </div> ) } const NewTaskForm = () => { const handleSubmit = async (event) => { event.preventDefault() try { const target = event.target const description = target.description.value target.reset()
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
MainPage.jsx:
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
export const getTasks = async (args, context) => { return context.entities.Task.findMany({ orderBy: { id: 'asc' } }) }
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
queries.js:
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
pp TodoApp { wasp: { version: "^0.13.0" }, title: "TodoApp" } route RootRoute { path: "/", to: MainPage } page MainPage { component: import { MainPage } from "@src/MainPage" } entity Task {=psl id Int @id @default(autoincrement()) description String isDone Boolean @default(false) psl=} query getTasks { fn: import { getTasks } from "@src/queries", entities: [Task] } action createTask { fn: import { createTask } from "@src/actions", entities: [Task] }
19 replies
WWasp-lang
Created by chad.bohlmann on 3/26/2024 in #đŸ™‹questions
AxiosError
Thanks Vinny and sodic! I'm following the tutorial at wasp-lang.dev/docs/tutorial. Here's main.wasp:
19 replies