
21 | 22 | Techno Stack 23 | 24 |
25 |26 | Check the README.md file for instructions on how to get this 27 | project deployed. 28 |
29 |26 | Check the README.md file for instructions on how to get this 27 | project deployed. 28 |
29 |{user.email}
29 | 37 |No notes yet
49 | ) : ( 50 |{data.note.body}
41 |6 | No note selected. Select a note on the left, or{" "} 7 | 8 | create a new note. 9 | 10 |
11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /app/routes/notes/new.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { Form, json, redirect, useActionData } from "remix"; 3 | import type { ActionFunction } from "remix"; 4 | import Alert from "@reach/alert"; 5 | 6 | import { createNote } from "~/models/note.server"; 7 | import { requireUserId } from "~/session.server"; 8 | 9 | type ActionData = { 10 | errors?: { 11 | title?: string; 12 | body?: string; 13 | }; 14 | }; 15 | 16 | export const action: ActionFunction = async ({ request }) => { 17 | const userId = await requireUserId(request); 18 | 19 | const formData = await request.formData(); 20 | const title = formData.get("title"); 21 | const body = formData.get("body"); 22 | 23 | if (typeof title !== "string" || title.length === 0) { 24 | return json