Skip to content

Commit

Permalink
fix: Resolve component rendering issue in _app.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Feb 3, 2025
1 parent d6eb1c1 commit c7a517c
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions routes/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Head } from "$fresh/runtime.ts";
import { getCookies } from "https://deno.land/std/http/cookie.ts";
import { oauth2Client } from "../utils/auth.ts";

export default async function App(props: AppProps) {
const { Component } = props;
export default function App({ Component, url }: AppProps) {
let user = null;

const cookies = props.state?.cookieMap ?? {};
const sessionId = cookies["session"];
const cookies = url?.searchParams?.get("__fresh_cookie") ?? "";
const cookieMap = new Map(cookies.split("&").map(pair => pair.split("=")));
const sessionId = cookieMap.get("session");

if (sessionId) {
try {
Expand All @@ -30,21 +30,19 @@ export default async function App(props: AppProps) {
}

return (
<html>
<>
<Head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SwanFactory Online</title>
<link rel="stylesheet" href="/styles.css" />
</Head>
<body>
<main>
<Component data={{ user }} />
</main>
<footer className="site-footer text-sm text-gray-500">
<p>&copy; 2025 The Swan Factory</p>
</footer>
</body>
</html>
<main>
<Component data={{ user }} />
</main>
<footer className="site-footer text-sm text-gray-500">
<p>&copy; 2025 The Swan Factory</p>
</footer>
</>
);
}

0 comments on commit c7a517c

Please sign in to comment.