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";
3
3
4
4
const config : CodegenConfig = {
5
5
schema : [
6
- // `${process.env.APP_ENDPOINT}${process.env.GRAPHQL_URI}`, // Серверная схема
6
+ `${ process . env . APP_ENDPOINT } ${ process . env . GRAPHQL_URI } ` ,
7
7
"src/api/schema.graphql" ,
8
8
] ,
9
9
documents : [ "src/**/*.graphql" ] ,
Original file line number Diff line number Diff line change @@ -36,16 +36,17 @@ const LectureDetailContainer: FC = () => {
36
36
fetchPolicy : FETCH_POLICY . CACHE_AND_NETWORK ,
37
37
} ) ;
38
38
39
- if (
40
- loadingLecture ||
41
- loadingLectureHomeWork ||
42
- loadingTrainingLectures ||
43
- ! tariffHomework
44
- )
39
+ if ( loadingLecture || loadingTrainingLectures ) {
45
40
return < AppSpinner /> ;
41
+ }
46
42
47
- if ( ! dataLecture || ! lectureId || ! dataTrainingLectures )
43
+ if ( tariffHomework && loadingLectureHomeWork ) {
44
+ return < AppSpinner /> ;
45
+ }
46
+
47
+ if ( ! dataLecture || ! lectureId || ! dataTrainingLectures ) {
48
48
return < NoDataErrorMessage /> ;
49
+ }
49
50
50
51
return (
51
52
< LectureDetail
Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ const useTariff = ({ trainingId }: ITariffHook) => {
10
10
const { data } = useTrainingPurchasesQuery ( ) ;
11
11
12
12
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
19
21
) ;
20
22
} , [ data , trainingId ] ) ;
21
23
You can’t perform that action at this time.
0 commit comments