diff --git a/src/redux/reducers/public.tsx b/src/redux/reducers/public.tsx index 3208850..636efd5 100644 --- a/src/redux/reducers/public.tsx +++ b/src/redux/reducers/public.tsx @@ -1,5 +1,7 @@ import { PublicAction } from "../actions-type"; import proxy from "../proxy"; +import location from '../../util/location'; + const initialState = { homeData: [], newProducts: [], @@ -69,13 +71,13 @@ export default function publicApi(state = initialState, action: PublicAction) { error: null, }; case "public/vod/bookSection": - const videoId: any = localStorage.getItem("category")?.split(",")[2]; + const videoId: any = location.getId(); return { ...state, loading: false, bookSection: data, error: null, - selectedVideo: data?.vods?.filter((item: any) => item.name === videoId)[0] + selectedVideo: data.vods?.filter((item: any) => item.id !== videoId)[0] }; case "public/vod/bookCourse": @@ -98,7 +100,7 @@ export default function publicApi(state = initialState, action: PublicAction) { categories: allCats.map((item: any) => data.vods.filter((item1: any) => item1.categoryId === item) ), - selectedVideo: data?.vods[0], + selectedVideo: data.vods.filter((item : any) => item.id !== location.getId())[0], }; case "public/homePage": let itemsLevel; diff --git a/src/router.js b/src/router.js index 89c3c3a..9c5d542 100644 --- a/src/router.js +++ b/src/router.js @@ -47,7 +47,7 @@ function router({ status }) { - + diff --git a/src/util/location.js b/src/util/location.js index eca402f..aa083ce 100644 --- a/src/util/location.js +++ b/src/util/location.js @@ -8,4 +8,4 @@ class location { const _location = new location(); -export default _location; +export default _location; \ No newline at end of file diff --git a/src/views/Course/Lesson/index.tsx b/src/views/Course/Lesson/index.tsx index a862a6f..16605bc 100644 --- a/src/views/Course/Lesson/index.tsx +++ b/src/views/Course/Lesson/index.tsx @@ -111,7 +111,7 @@ function Lesson({