@@ -15,7 +53,7 @@ export default function Home() {
diff --git a/apps/frontend/src/pages/post.tsx b/apps/frontend/src/pages/post.tsx
index e69de29..0798638 100644
--- a/apps/frontend/src/pages/post.tsx
+++ b/apps/frontend/src/pages/post.tsx
@@ -0,0 +1,40 @@
+import Layout from "../components/layout";
+import { useState, useEffect } from "react";
+import { useParams } from "react-router-dom";
+import type { Post } from "../utils/types";
+
+export default function Post() {
+ const [post, setPost] = useState
(null);
+ const params = useParams();
+
+ useEffect(() => {
+ if (params.slug) {
+ fetch("/api/posts/" + params.slug, {
+ method: "GET",
+ credentials: "include",
+ }).then(async (res) => {
+ if (res.ok) {
+ const data = await res.json();
+ setPost(data);
+ } else {
+ console.error("Failed to load post! " + res.status);
+ }
+ });
+ }
+ }, []);
+
+ useEffect(() => {
+ console.log(post);
+ }, [post]);
+
+ if (post) {
+ return (
+
+
+
{post.title}
+
{post.description}
+
+
+ );
+ }
+}
diff --git a/apps/frontend/src/providers/AuthProvider.tsx b/apps/frontend/src/providers/AuthProvider.tsx
index c3a8552..2d6b47e 100644
--- a/apps/frontend/src/providers/AuthProvider.tsx
+++ b/apps/frontend/src/providers/AuthProvider.tsx
@@ -6,12 +6,7 @@ import {
type ReactNode,
useEffect,
} from "react";
-
-interface User {
- id: number;
- email: string;
- name: string;
-}
+import type { User } from "../utils/types";
interface AuthContextType {
user: User | null;
refetch: () => void;
diff --git a/apps/frontend/src/utils/types.ts b/apps/frontend/src/utils/types.ts
new file mode 100644
index 0000000..d3fc162
--- /dev/null
+++ b/apps/frontend/src/utils/types.ts
@@ -0,0 +1,17 @@
+interface Post {
+ id: number;
+ title: string;
+ description: string;
+ slug: string;
+ content: string;
+ createdAt: string;
+ updatedAt: string;
+ userId: number;
+}
+interface User {
+ id: number;
+ email: string;
+ name: string;
+}
+
+export type { Post, User };