11import React , { useCallback , useEffect , useState } from 'react' ;
2- import { useHistory , useLocation , useParams } from 'react-router-dom' ;
3- import { Schedule } from '@/api/server/schedules/getServerSchedules' ;
2+ import { useHistory , useParams } from 'react-router-dom' ;
43import getServerSchedule from '@/api/server/schedules/getServerSchedule' ;
54import Spinner from '@/components/elements/Spinner' ;
65import FlashMessageRender from '@/components/FlashMessageRender' ;
@@ -23,10 +22,6 @@ interface Params {
2322 id : string ;
2423}
2524
26- interface State {
27- schedule ?: Schedule ;
28- }
29-
3025const CronBox = ( { title, value } : { title : string ; value : string } ) => (
3126 < div css = { tw `bg-neutral-700 rounded p-3` } >
3227 < p css = { tw `text-neutral-300 text-sm` } > { title } </ p >
@@ -47,7 +42,6 @@ const ActivePill = ({ active }: { active: boolean }) => (
4742
4843export default ( ) => {
4944 const history = useHistory ( ) ;
50- const { state } = useLocation < State > ( ) ;
5145 const { id : scheduleId } = useParams < Params > ( ) ;
5246
5347 const id = ServerContext . useStoreState ( state => state . server . data ! . id ) ;
@@ -57,7 +51,7 @@ export default () => {
5751 const [ isLoading , setIsLoading ] = useState ( true ) ;
5852 const [ showEditModal , setShowEditModal ] = useState ( false ) ;
5953
60- const schedule = ServerContext . useStoreState ( st => st . schedules . data . find ( s => s . id === state . schedule ?. id ) , isEqual ) ;
54+ const schedule = ServerContext . useStoreState ( st => st . schedules . data . find ( s => s . id === Number ( scheduleId ) ) , isEqual ) ;
6155 const appendSchedule = ServerContext . useStoreActions ( actions => actions . schedules . appendSchedule ) ;
6256
6357 useEffect ( ( ) => {
0 commit comments