fix: Redirect to chat if token is defined (#675)

* fix: Redirect to chat if token is defined

* cr

* cr
This commit is contained in:
Brace Sproul 2025-08-04 18:12:26 -07:00 • committed by GitHub
parent 162d66016e
commit 229b65bff4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,5 @@
"use client";
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { GitHubSVG } from "@/components/icons/github";
@ -42,6 +43,13 @@ function AuthStatusContent() {
fetchGitHubToken,
]);
useEffect(() => {
if (githubToken) {
console.log("redirecting to chat");
router.push("/chat");
}
}, [githubToken]);
const checkAuthStatus = async () => {
try {
const response = await fetch("/api/auth/status");
@ -172,6 +180,7 @@ function AuthStatusContent() {
</div>
);
}
return null;
}