mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-04 16:02:13 +00:00
fix: Redirect to chat if token is defined (#675)
* fix: Redirect to chat if token is defined * cr * cr
This commit is contained in:
parent
162d66016e
commit
229b65bff4
1 changed files with 9 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { GitHubSVG } from "@/components/icons/github";
|
import { GitHubSVG } from "@/components/icons/github";
|
||||||
|
|
@ -42,6 +43,13 @@ function AuthStatusContent() {
|
||||||
fetchGitHubToken,
|
fetchGitHubToken,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (githubToken) {
|
||||||
|
console.log("redirecting to chat");
|
||||||
|
router.push("/chat");
|
||||||
|
}
|
||||||
|
}, [githubToken]);
|
||||||
|
|
||||||
const checkAuthStatus = async () => {
|
const checkAuthStatus = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/auth/status");
|
const response = await fetch("/api/auth/status");
|
||||||
|
|
@ -172,6 +180,7 @@ function AuthStatusContent() {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue