File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
resources/scripts/components/server/schedules Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,9 @@ const ActivePill = ({ active }: { active: boolean }) => (
4646) ;
4747
4848export default ( ) => {
49- const params = useParams ( ) as Params ;
5049 const history = useHistory ( ) ;
51- const state : State = useLocation ( ) . state ;
50+ const { state } = useLocation < State > ( ) ;
51+ const { id : scheduleId } = useParams < Params > ( ) ;
5252
5353 const id = ServerContext . useStoreState ( state => state . server . data ! . id ) ;
5454 const uuid = ServerContext . useStoreState ( state => state . server . data ! . uuid ) ;
@@ -61,20 +61,20 @@ export default () => {
6161 const appendSchedule = ServerContext . useStoreActions ( actions => actions . schedules . appendSchedule ) ;
6262
6363 useEffect ( ( ) => {
64- if ( schedule ?. id === Number ( params . id ) ) {
64+ if ( schedule ?. id === Number ( scheduleId ) ) {
6565 setIsLoading ( false ) ;
6666 return ;
6767 }
6868
6969 clearFlashes ( 'schedules' ) ;
70- getServerSchedule ( uuid , Number ( params . id ) )
70+ getServerSchedule ( uuid , Number ( scheduleId ) )
7171 . then ( schedule => appendSchedule ( schedule ) )
7272 . catch ( error => {
7373 console . error ( error ) ;
7474 clearAndAddHttpError ( { error, key : 'schedules' } ) ;
7575 } )
7676 . then ( ( ) => setIsLoading ( false ) ) ;
77- } , [ params ] ) ;
77+ } , [ scheduleId ] ) ;
7878
7979 const toggleEditModal = useCallback ( ( ) => {
8080 setShowEditModal ( s => ! s ) ;
You can’t perform that action at this time.
0 commit comments