Skip to content

Commit

Permalink
docs: fix reverted snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrenon committed Dec 17, 2024
1 parent 1895a09 commit 8203cba
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions content/docs/guides/neon-authorize.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,15 @@ CREATE POLICY "create todos" ON "todos"
Now, in your backend, you can simplify the logic, removing the user authentication checks and explicit authorization handling.

```typescript shouldWrap
export async function insertTodo(newTodo: { newTodo: string }) {
export async function insertTodo({ newTodo }: { newTodo: string }) {
const { getToken } = auth();
const authToken = await getToken();
const db = drizzle(process.env.DATABASE_AUTHENTICATED_URL!, { schema });

await fetchWithDrizzle(async (db) => {
return db.insert(schema.todos).values({
task: newTodo.newTodo,
isComplete: false,
});
return db.$withAuth(authToken).insert(schema.todos).values({
task: newTodo,
isComplete: false,
});

revalidatePath('/');
}
```

Expand Down

0 comments on commit 8203cba

Please sign in to comment.