diff --git a/frontend/src/pages/roster/Roster.jsx b/frontend/src/pages/roster/Roster.jsx index 1a39bce..03f53a3 100644 --- a/frontend/src/pages/roster/Roster.jsx +++ b/frontend/src/pages/roster/Roster.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { Upload, CheckCircle, Trash2, Clock, Users } from 'lucide-react' +import { Upload, CheckCircle, Trash2, Clock, Users, RefreshCw } from 'lucide-react' import api from '../../api' import toast from 'react-hot-toast' @@ -63,6 +63,21 @@ export default function RosterPage() { } } + const handleRecalc = async () => { + setLoading(true) + try { + await Promise.all([ + api.get('/api/roster/info'), + api.get('/api/roster/data').catch(() => ({ data: { headers: [], rows: [] } })) + ]) + toast.success('已重新計算') + } catch { + toast.error('重新計算失敗') + } finally { + loadRosterData() + } + } + if (loading) { return