mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
# What does this PR do? ## Test Plan # What does this PR do? ## Test Plan # What does this PR do? ## Test Plan
28 lines
723 B
TypeScript
28 lines
723 B
TypeScript
import { useState, useEffect } from "react";
|
|
|
|
export function useAuthConfig() {
|
|
const [isAuthConfigured, setIsAuthConfigured] = useState(true);
|
|
const [isChecking, setIsChecking] = useState(true);
|
|
|
|
useEffect(() => {
|
|
const checkAuthConfig = async () => {
|
|
try {
|
|
const response = await fetch("/api/auth/github/login", {
|
|
method: "HEAD",
|
|
redirect: "manual",
|
|
});
|
|
|
|
setIsAuthConfigured(response.status !== 404);
|
|
} catch (error) {
|
|
console.error("Auth config check error:", error);
|
|
setIsAuthConfigured(true);
|
|
} finally {
|
|
setIsChecking(false);
|
|
}
|
|
};
|
|
|
|
checkAuthConfig();
|
|
}, []);
|
|
|
|
return { isAuthConfigured, isChecking };
|
|
}
|