File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed
src/features/lecture-detail
containers/lecture-detail Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import "dotenv/config";
33
44const config : CodegenConfig = {
55 schema : [
6- // `${process.env.APP_ENDPOINT}${process.env.GRAPHQL_URI}`, // Серверная схема
6+ `${ process . env . APP_ENDPOINT } ${ process . env . GRAPHQL_URI } ` ,
77 "src/api/schema.graphql" ,
88 ] ,
99 documents : [ "src/**/*.graphql" ] ,
Original file line number Diff line number Diff line change @@ -36,16 +36,17 @@ const LectureDetailContainer: FC = () => {
3636 fetchPolicy : FETCH_POLICY . CACHE_AND_NETWORK ,
3737 } ) ;
3838
39- if (
40- loadingLecture ||
41- loadingLectureHomeWork ||
42- loadingTrainingLectures ||
43- ! tariffHomework
44- )
39+ if ( loadingLecture || loadingTrainingLectures ) {
4540 return < AppSpinner /> ;
41+ }
4642
47- if ( ! dataLecture || ! lectureId || ! dataTrainingLectures )
43+ if ( tariffHomework && loadingLectureHomeWork ) {
44+ return < AppSpinner /> ;
45+ }
46+
47+ if ( ! dataLecture || ! lectureId || ! dataTrainingLectures ) {
4848 return < NoDataErrorMessage /> ;
49+ }
4950
5051 return (
5152 < LectureDetail
Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ const useTariff = ({ trainingId }: ITariffHook) => {
1010 const { data } = useTrainingPurchasesQuery ( ) ;
1111
1212 const tariffHomework = useMemo ( ( ) => {
13- return (
14- data ?. trainingPurchases ?. some (
15- ( item ) =>
16- item ?. trainingTariff . training ?. id === trainingId &&
17- item ?. trainingTariff . homeWork
18- ) ?? false
13+ if ( ! trainingId || ! data ?. trainingPurchases ) {
14+ return false ;
15+ }
16+
17+ return data . trainingPurchases . some (
18+ ( item ) =>
19+ item ?. trainingTariff . training ?. id === trainingId &&
20+ item ?. trainingTariff . homeWork
1921 ) ;
2022 } , [ data , trainingId ] ) ;
2123
You can’t perform that action at this time.
0 commit comments