diff --git a/examples/thoughts/main.wasp b/examples/thoughts/main.wasp index 169384c2c..59d8758e6 100644 --- a/examples/thoughts/main.wasp +++ b/examples/thoughts/main.wasp @@ -1,20 +1,21 @@ app Thoughts { wasp: { - version: "^0.9.1" + version: "^0.10.0" }, title: "Thoughts", - db: { system: PostgreSQL }, + db: { + system: PostgreSQL, + seeds: [ import { devSeedBasic } from "@server/seeds.js" ] + }, auth: { userEntity: User, - methods: { - usernameAndPassword: {} - }, + methods: { usernameAndPassword: {} }, onAuthFailedRedirectTo: "/login" }, dependencies: [ ("react-markdown", "6.0.1"), ("color-hash", "2.0.1") - ] + ], } route MainRoute { path: "/", to: MainPage } diff --git a/examples/thoughts/src/client/LoginPage.jsx b/examples/thoughts/src/client/LoginPage.jsx index 36538d3a4..35e47ce24 100644 --- a/examples/thoughts/src/client/LoginPage.jsx +++ b/examples/thoughts/src/client/LoginPage.jsx @@ -1,17 +1,19 @@ import React from 'react' import { Link } from 'react-router-dom' -import LoginForm from '@wasp/auth/forms/Login' +import { LoginForm } from '@wasp/auth/forms/Login' import addWaspSourceHeader from './addWaspSourceHeader' const LoginPage = (props) => { return ( <> - -
- - I don't have an account yet (go to signup). - +
+ +
+ + I don't have an account yet (go to signup). + +
) } diff --git a/examples/thoughts/src/client/SignupPage.jsx b/examples/thoughts/src/client/SignupPage.jsx index a8ebc5479..a6c47ad40 100644 --- a/examples/thoughts/src/client/SignupPage.jsx +++ b/examples/thoughts/src/client/SignupPage.jsx @@ -1,17 +1,19 @@ import React from 'react' import { Link } from 'react-router-dom' -import SignupForm from '@wasp/auth/forms/Signup' +import { SignupForm } from '@wasp/auth/forms/Signup' import addWaspSourceHeader from './addWaspSourceHeader' const SignupPage = (props) => { return ( <> - -
- - I already have an account (go to login). - +
+ +
+ + I already have an account (go to login). + +
) } diff --git a/examples/thoughts/src/server/seeds.js b/examples/thoughts/src/server/seeds.js new file mode 100644 index 000000000..a2a0c5410 --- /dev/null +++ b/examples/thoughts/src/server/seeds.js @@ -0,0 +1,18 @@ +import { createThought } from './actions.js' + +export const devSeedBasic = async (prismaClient) => { + const user = await createUser(prismaClient, { + username: "RiuTheDog", + password: "bark1234" + }) + + await createThought( + { tagNames: ["animals.cats"], textMarkdown: "## My favorite cats\n - Kira\n - Garfield" }, + { user, entities: { Thought: prismaClient.thought } } + ) +} + +async function createUser (prismaClient, data) { + const { password, ...newUser } = await prismaClient.user.create({ data }) + return newUser +} \ No newline at end of file