completionId: cgen-d6b86a271c654d30b16582fbbba4eddd
cgen-d6b86a271c654d30b16582fbbba4eddd
This commit is contained in:
parent
9884bc78ee
commit
c09bfa1879
1 changed files with 19 additions and 0 deletions
|
|
@ -56,11 +56,30 @@ export function AdminDiscordManagement() {
|
|||
const [isRegisteringCommands, setIsRegisteringCommands] = useState(false);
|
||||
const [registerError, setRegisterError] = useState<string | null>(null);
|
||||
const [registerSuccess, setRegisterSuccess] = useState<string | null>(null);
|
||||
const [botHealth, setBotHealth] = useState<BotHealthStatus | null>(null);
|
||||
const [botHealthLoading, setBotHealthLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
fetchMappings();
|
||||
checkBotHealthStatus();
|
||||
|
||||
// Refresh bot health every 30 seconds
|
||||
const interval = setInterval(checkBotHealthStatus, 30000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
const checkBotHealthStatus = async () => {
|
||||
setBotHealthLoading(true);
|
||||
try {
|
||||
const health = await checkBotHealth();
|
||||
setBotHealth(health);
|
||||
} catch (err) {
|
||||
console.error("Error checking bot health:", err);
|
||||
} finally {
|
||||
setBotHealthLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchMappings = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue