Add ESI data refresh functionality to settings buttons
This commit is contained in:
@@ -83,6 +83,26 @@ export const SettingsButton = () => {
|
||||
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 (
|
||||
<Tooltip title="Toggle settings dialog">
|
||||
<>
|
||||
@@ -128,6 +148,14 @@ export const SettingsButton = () => {
|
||||
|
||||
<Box sx={{ mt: 2 }}>
|
||||
<Typography variant="subtitle1">Data Refresh</Typography>
|
||||
<Button
|
||||
onClick={handleRefreshESI}
|
||||
variant="contained"
|
||||
fullWidth
|
||||
sx={{ mt: 1 }}
|
||||
>
|
||||
Refresh ESI Data
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleRefreshStats}
|
||||
variant="outlined"
|
||||
|
Reference in New Issue
Block a user