Skip to content

Commit 8edfcaf

Browse files
committed
lint fixes
1 parent cd4ef32 commit 8edfcaf

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,6 @@ const FreeCodeCamp: FC<{}> = () => {
8080
lessonParam,
8181
)
8282

83-
if (courseDataReady && courseData) {
84-
const moduleParamData = courseData.modules.find(m => m.key === moduleParam) ?? courseData.modules[0];
85-
const lessonParamExists = moduleParamData?.lessons.find(l => l.dashedName === lessonParam);
86-
87-
if (!lessonParamExists) {
88-
const lessonPath: string = getLessonPathFromModule(
89-
providerParam,
90-
certificationParam,
91-
moduleParamData.key,
92-
moduleParamData.lessons[0].dashedName,
93-
)
94-
95-
navigate(lessonPath)
96-
}
97-
}
98-
9983
const ready: boolean = profileReady && courseDataReady && lessonReady && (!isLoggedIn || progressReady)
10084

10185
const certification: string = lesson?.course.certification ?? ''
@@ -301,6 +285,32 @@ const FreeCodeCamp: FC<{}> = () => {
301285
setCertificateProgress,
302286
])
303287

288+
useEffect(() => {
289+
if (courseDataReady && courseData) {
290+
const moduleParamData: LearnModule = courseData.modules.find(m => m.key === moduleParam) ?? courseData.modules[0]
291+
const lessonParamExists: boolean = !!moduleParamData?.lessons.find(l => l.dashedName === lessonParam)
292+
293+
if (!lessonParamExists) {
294+
const lessonPath: string = getLessonPathFromModule(
295+
providerParam,
296+
certificationParam,
297+
moduleParamData.key,
298+
moduleParamData.lessons[0].dashedName,
299+
)
300+
301+
navigate(lessonPath)
302+
}
303+
}
304+
}, [
305+
certificationParam,
306+
courseData,
307+
courseDataReady,
308+
lessonParam,
309+
moduleParam,
310+
navigate,
311+
providerParam,
312+
])
313+
304314
useEffect(() => {
305315
const certificationPath: string = routeParams.certification ?? ''
306316
const modulePath: string = routeParams.module ?? ''

src-ts/tools/learn/learn-lib/functions/learn-xhr.functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
1+
import { AxiosInstance, AxiosRequestConfig } from 'axios'
22

33
import { xhrCreateInstance, xhrGetAsync, xhrPostAsync, xhrPutAsync } from '../../../../lib'
44

0 commit comments

Comments
 (0)