Add ESI data refresh functionality to settings buttons

This commit is contained in:
2025-09-23 10:04:27 +02:00
parent f081b3aba2
commit 0a5c256569

View File

@@ -83,6 +83,26 @@ export const SettingsButton = () => {
window.location.reload(); window.location.reload();
}; };
const handleRefreshESI = async () => {
try {
const response = await fetch("/api/refresh", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ force: true })
});
if (response.ok) {
console.log("✅ ESI data refreshed successfully");
// Optionally reload the page to show fresh data
window.location.reload();
} else {
console.error("❌ Failed to refresh ESI data");
}
} catch (error) {
console.error("❌ Error refreshing ESI data:", error);
}
};
return ( return (
<Tooltip title="Toggle settings dialog"> <Tooltip title="Toggle settings dialog">
<> <>
@@ -128,6 +148,14 @@ export const SettingsButton = () => {
<Box sx={{ mt: 2 }}> <Box sx={{ mt: 2 }}>
<Typography variant="subtitle1">Data Refresh</Typography> <Typography variant="subtitle1">Data Refresh</Typography>
<Button
onClick={handleRefreshESI}
variant="contained"
fullWidth
sx={{ mt: 1 }}
>
Refresh ESI Data
</Button>
<Button <Button
onClick={handleRefreshStats} onClick={handleRefreshStats}
variant="outlined" variant="outlined"