26 lines
661 B
TypeScript
26 lines
661 B
TypeScript
import { getAuth } from "@/app/actions/auth";
|
|
import { getNotes } from "@/app/actions/notes";
|
|
import NoteCard from "@/components/ui/NoteCard";
|
|
import { Metadata } from "next";
|
|
import { redirect } from "next/navigation";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Notes - Rhyme",
|
|
description: "View and edit your notes",
|
|
};
|
|
|
|
export default async function Notes() {
|
|
const user = await getAuth();
|
|
if (!user) {
|
|
redirect("/auth");
|
|
}
|
|
const notes = await getNotes(user);
|
|
|
|
return (
|
|
<>
|
|
<h1 className="font-bold text-xl mb-4">Notes of {user.username}:</h1>
|
|
{notes.map((note) => <NoteCard key={note.id} note={note} /> )}
|
|
</>
|
|
);
|
|
}
|