Skip to content

Commit 52308af

Browse files
committed
Normalize this code.
1 parent c71c1e5 commit 52308af

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

resources/scripts/components/server/schedules/ScheduleEditContainer.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ const ActivePill = ({ active }: { active: boolean }) => (
4646
);
4747

4848
export 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);

0 commit comments

Comments
 (0)