Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update page.tsx #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/notes/CreateNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export default function CreateNote() {

const router = useRouter();

const create = async() => {
const create = async(e: React.FormEvent) => {
// const db = new PocketBase('http://127.0.0.1:8090');

// await db.records.create('notes', {
// title,
// content,
// });

e.preventDefault()
await fetch('http://127.0.0.1:8090/api/collections/notes/records', {
method: 'POST',
headers: {
Expand All @@ -43,7 +43,7 @@ export default function CreateNote() {
}

return (
<form onSubmit={create}>
<form onSubmit={(e)=>create(event)}>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passing e and calling it event. should be e or event for both.

<h3>Create a new Note</h3>
<input
type="text"
Expand Down
2 changes: 1 addition & 1 deletion app/notes/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import PocketBase from 'pocketbase';
import Link from 'next/link';
import styles from './Notes.module.css';
import CreateNote from './Create';
import CreateNote from './CreateNote';

// export const dynamic = 'auto',
// dynamicParams = true,
Expand Down