feat: KöPi Tages-Cron um 06:00 Uhr mit Pushover, Admin-Testbutton zum manuellen Auslösen
This commit is contained in:
@@ -170,6 +170,16 @@ export default function Koepi({ toast }) {
|
||||
} catch(e) { toast?.(e.message,'error'); }
|
||||
};
|
||||
|
||||
const [cronRunning, setCronRunning] = useState(false);
|
||||
const testDailyCheck = async () => {
|
||||
setCronRunning(true);
|
||||
try {
|
||||
const r = await api('/tools/koepi/run-daily-check', { method:'POST', body:{} });
|
||||
toast(`🔔 Test: ${r.offerCount} Angebot(e) gefunden, Pushover ${r.sent ? 'versendet' : 'nicht versendet'}${r.changed ? ' (Änderung erkannt)' : ' (unverändert)'}`);
|
||||
} catch(e) { toast?.(e.message||'Fehler','error'); }
|
||||
finally { setCronRunning(false); }
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ maxWidth:700, margin:'0 auto' }}>
|
||||
{/* Header */}
|
||||
@@ -179,7 +189,12 @@ export default function Koepi({ toast }) {
|
||||
</h2>
|
||||
<div style={{ flex:1 }}/>
|
||||
{isAdmin && (
|
||||
<button onClick={clearCache} style={{ ...S.btn('#666666',true), fontSize:10 }}>🗑 Cache leeren</button>
|
||||
<>
|
||||
<button onClick={testDailyCheck} disabled={cronRunning} style={{ ...S.btn('#f59e0b',true), fontSize:10, opacity:cronRunning?0.5:1 }}>
|
||||
{cronRunning ? '⏳ läuft…' : '🔔 Cron testen'}
|
||||
</button>
|
||||
<button onClick={clearCache} style={{ ...S.btn('#666666',true), fontSize:10 }}>🗑 Cache leeren</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user