@elice/material-shared-utils 1.230220.2 → 1.230306.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +2 -2
- package/cjs/material-fetch/index.d.ts +1 -1
- package/cjs/material-fetch/useMaterialFetch.d.ts +60 -11
- package/cjs/material-fetch/useMaterialFetch.js +19 -33
- package/cjs/material-fetch/useMaterialFetchRaw.d.ts +43 -0
- package/cjs/material-fetch/useMaterialFetchRaw.js +112 -0
- package/es/index.js +1 -1
- package/es/material-fetch/index.d.ts +1 -1
- package/es/material-fetch/useMaterialFetch.d.ts +60 -11
- package/es/material-fetch/useMaterialFetch.js +19 -33
- package/es/material-fetch/useMaterialFetchRaw.d.ts +43 -0
- package/es/material-fetch/useMaterialFetchRaw.js +108 -0
- package/package.json +6 -6
- package/cjs/material-fetch/useMaterialInitFetch.d.ts +0 -22
- package/cjs/material-fetch/useMaterialInitFetch.js +0 -54
- package/es/material-fetch/useMaterialInitFetch.d.ts +0 -22
- package/es/material-fetch/useMaterialInitFetch.js +0 -50
package/cjs/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var useMaterialConfig = require('./material-config/useMaterialConfig.js');
|
|
|
9
9
|
var useMaterialConfigApiClientUpdate = require('./material-config/useMaterialConfigApiClientUpdate.js');
|
|
10
10
|
var utils = require('./material-config/utils.js');
|
|
11
11
|
var useMaterialFetch = require('./material-fetch/useMaterialFetch.js');
|
|
12
|
-
var
|
|
12
|
+
var useMaterialFetchRaw = require('./material-fetch/useMaterialFetchRaw.js');
|
|
13
13
|
var withMaterial = require('./material-hoc/withMaterial.js');
|
|
14
14
|
|
|
15
15
|
|
|
@@ -21,6 +21,6 @@ exports.useMaterialConfig = useMaterialConfig.useMaterialConfig;
|
|
|
21
21
|
exports.useMaterialConfigApiClientUpdate = useMaterialConfigApiClientUpdate.useMaterialConfigApiClientUpdate;
|
|
22
22
|
exports.updateMaterialConfigSessionKey = utils.updateMaterialConfigSessionKey;
|
|
23
23
|
exports.useMaterialFetch = useMaterialFetch.useMaterialFetch;
|
|
24
|
-
exports.
|
|
24
|
+
exports.useMaterialFetchRaw = useMaterialFetchRaw.useMaterialFetchRaw;
|
|
25
25
|
exports.withForwardRefMaterial = withMaterial.withForwardRefMaterial;
|
|
26
26
|
exports.withMaterial = withMaterial.withMaterial;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './useMaterialFetch';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './useMaterialFetchRaw';
|
|
@@ -1,21 +1,70 @@
|
|
|
1
|
-
import type { EliceApiResponse } from '@elice/api-client';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { EliceApiClientConfigs, EliceApiResponse } from '@elice/api-client';
|
|
2
|
+
import type { enums } from '@elice/types';
|
|
3
|
+
import type { FetchKeyMap } from './useMaterialFetchRaw';
|
|
4
|
+
declare type FetchClientInitializer = (config: EliceApiClientConfigs) => void;
|
|
4
5
|
/**
|
|
5
6
|
* Init api client and fetch material for contaner.
|
|
6
7
|
*
|
|
7
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
8
|
-
* @param isReady Is ready to fetch material.
|
|
9
|
-
*
|
|
10
8
|
* @example
|
|
11
|
-
* const
|
|
12
|
-
* useMaterialFetch
|
|
9
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
10
|
+
* useMaterialFetch(
|
|
11
|
+
* enums.LectureMaterialType.PDF,
|
|
13
12
|
* React.useCallback(
|
|
14
|
-
* signal =>
|
|
13
|
+
* signal =>
|
|
14
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
15
|
+
* { materialPdfId },
|
|
16
|
+
* { signal }
|
|
17
|
+
* ),
|
|
15
18
|
* [materialPdfId]
|
|
16
19
|
* ),
|
|
17
|
-
*
|
|
20
|
+
* eliceApiClientConfigs.init
|
|
18
21
|
* );
|
|
19
22
|
*/
|
|
20
|
-
export declare const useMaterialFetch: <R = any
|
|
23
|
+
export declare const useMaterialFetch: <MT extends enums.LectureMaterialType, R extends Record<FetchKeyMap[MT], Record<string, any>> = Record<FetchKeyMap[MT], Record<string, any>>>(materialType: MT, materialFetchFn: (signal?: AbortSignal | undefined) => Promise<EliceApiResponse<R>>, init: FetchClientInitializer) => Record<FetchKeyMap[MT], R[FetchKeyMap[MT]] | null> & {
|
|
24
|
+
materialLecturePage: {
|
|
25
|
+
certificateDescription: string | null;
|
|
26
|
+
certificateFileUrl: string | null;
|
|
27
|
+
certificateTitle: string | null;
|
|
28
|
+
closeDatetime: number | null;
|
|
29
|
+
closeScheduleDatetime: number | null;
|
|
30
|
+
courseId: number;
|
|
31
|
+
createdDatetime: number;
|
|
32
|
+
id: number;
|
|
33
|
+
isCertificateEnabled: boolean;
|
|
34
|
+
isCompleted: boolean;
|
|
35
|
+
isEnrolledStudentResponded: boolean;
|
|
36
|
+
isForStats: boolean;
|
|
37
|
+
isGraded: boolean;
|
|
38
|
+
isLibraryInstance: boolean;
|
|
39
|
+
isOpened: boolean;
|
|
40
|
+
isResponded: boolean;
|
|
41
|
+
lectureGroupType: enums.LectureGroupType | null;
|
|
42
|
+
lectureId: number;
|
|
43
|
+
mainOrderNo: number;
|
|
44
|
+
materialId: number;
|
|
45
|
+
materialKey: string;
|
|
46
|
+
materialType: enums.LectureMaterialType;
|
|
47
|
+
modifiedDatetime: number;
|
|
48
|
+
openScheduleDatetime: number | null;
|
|
49
|
+
originCourse: {
|
|
50
|
+
id: number;
|
|
51
|
+
title: string;
|
|
52
|
+
organization: {
|
|
53
|
+
id: number;
|
|
54
|
+
name: string;
|
|
55
|
+
nameShort: string;
|
|
56
|
+
};
|
|
57
|
+
} | null;
|
|
58
|
+
originLecturePageId: number | null;
|
|
59
|
+
point: number;
|
|
60
|
+
score: number;
|
|
61
|
+
subLecturePageIds: number[];
|
|
62
|
+
subOrderNo: number | null;
|
|
63
|
+
taglist: string[];
|
|
64
|
+
title: string;
|
|
65
|
+
} | null;
|
|
66
|
+
} & {
|
|
67
|
+
status: import("@elice/material-shared-types").APIStatus;
|
|
68
|
+
refetch: (signal?: AbortSignal | undefined) => Promise<void>;
|
|
69
|
+
};
|
|
21
70
|
export {};
|
|
@@ -2,50 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require('react');
|
|
6
|
+
require('../material-config/MaterialConfigContext.js');
|
|
7
|
+
var useMaterialConfigApiClientUpdate = require('../material-config/useMaterialConfigApiClientUpdate.js');
|
|
8
|
+
var useMaterialFetchRaw = require('./useMaterialFetchRaw.js');
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
//
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* Init api client and fetch material for contaner.
|
|
9
15
|
*
|
|
10
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
11
|
-
* @param isReady Is ready to fetch material.
|
|
12
|
-
*
|
|
13
16
|
* @example
|
|
14
|
-
* const
|
|
15
|
-
* useMaterialFetch
|
|
17
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
18
|
+
* useMaterialFetch(
|
|
19
|
+
* enums.LectureMaterialType.PDF,
|
|
16
20
|
* React.useCallback(
|
|
17
|
-
* signal =>
|
|
21
|
+
* signal =>
|
|
22
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
23
|
+
* { materialPdfId },
|
|
24
|
+
* { signal }
|
|
25
|
+
* ),
|
|
18
26
|
* [materialPdfId]
|
|
19
27
|
* ),
|
|
20
|
-
*
|
|
28
|
+
* eliceApiClientConfigs.init
|
|
21
29
|
* );
|
|
22
30
|
*/
|
|
23
31
|
|
|
24
|
-
const useMaterialFetch = (
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
React.useEffect(() => {
|
|
28
|
-
if (!isReady) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
setMaterial(null);
|
|
33
|
-
setMaterialStatus('pending');
|
|
34
|
-
const abortCtrl = new AbortController();
|
|
35
|
-
fn(abortCtrl.signal).then(res => {
|
|
36
|
-
setMaterial(res);
|
|
37
|
-
setMaterialStatus('resolved');
|
|
38
|
-
}).catch(err => {
|
|
39
|
-
if (err.name !== 'AbortError') {
|
|
40
|
-
setMaterial(null);
|
|
41
|
-
setMaterialStatus('rejected');
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return () => {
|
|
45
|
-
abortCtrl.abort();
|
|
46
|
-
};
|
|
47
|
-
}, [isReady, fn]);
|
|
48
|
-
return [material, materialStatus];
|
|
32
|
+
const useMaterialFetch = (materialType, materialFetchFn, init) => {
|
|
33
|
+
const isReady = useMaterialConfigApiClientUpdate.useMaterialConfigApiClientUpdate(init);
|
|
34
|
+
return useMaterialFetchRaw.useMaterialFetchRaw(materialType, materialFetchFn, isReady);
|
|
49
35
|
};
|
|
50
36
|
|
|
51
37
|
exports.useMaterialFetch = useMaterialFetch;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { enums } from '@elice/types';
|
|
2
|
+
import type { EliceApiResponse } from '@elice/api-client';
|
|
3
|
+
import type { APIStatus } from '@elice/material-shared-types';
|
|
4
|
+
import type { GetOrgLecturePageGetResponses } from '@elice/types';
|
|
5
|
+
export interface FetchKeyMap {
|
|
6
|
+
[enums.LectureMaterialType.Nothing]: 'materialNothing';
|
|
7
|
+
[enums.LectureMaterialType.Note]: 'materialNote';
|
|
8
|
+
[enums.LectureMaterialType.Video]: 'materialVideo';
|
|
9
|
+
[enums.LectureMaterialType.PDF]: 'materialPdf';
|
|
10
|
+
[enums.LectureMaterialType.Exercise]: 'materialExercise';
|
|
11
|
+
[enums.LectureMaterialType.Quiz]: 'materialQuiz';
|
|
12
|
+
[enums.LectureMaterialType.Runbox]: 'materialRunbox';
|
|
13
|
+
[enums.LectureMaterialType.VideoFile]: 'materialVideoFile';
|
|
14
|
+
[enums.LectureMaterialType.Live]: 'materialLive';
|
|
15
|
+
[enums.LectureMaterialType.Assignment]: 'materialAssignment';
|
|
16
|
+
[enums.LectureMaterialType.LMSPublicContent]: 'materialLmsPublicContent';
|
|
17
|
+
[enums.LectureMaterialType.External]: 'materialExternal';
|
|
18
|
+
[enums.LectureMaterialType.Survey]: 'materialSurvey';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Init api client and fetch material for contaner.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
25
|
+
* useMaterialFetchRaw(
|
|
26
|
+
* enums.LectureMaterialType.PDF,
|
|
27
|
+
* React.useCallback(
|
|
28
|
+
* signal =>
|
|
29
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
30
|
+
* { materialPdfId },
|
|
31
|
+
* { signal }
|
|
32
|
+
* ),
|
|
33
|
+
* [materialPdfId]
|
|
34
|
+
* ),
|
|
35
|
+
* isReady // boolean
|
|
36
|
+
* );
|
|
37
|
+
*/
|
|
38
|
+
export declare const useMaterialFetchRaw: <MT extends enums.LectureMaterialType, R extends Record<FetchKeyMap[MT], Record<string, any>> = Record<FetchKeyMap[MT], Record<string, any>>>(materialType: MT, materialFetchFn: (signal?: AbortSignal | undefined) => Promise<EliceApiResponse<R>>, isReady?: boolean) => Record<FetchKeyMap[MT], R[FetchKeyMap[MT]] | null> & {
|
|
39
|
+
materialLecturePage: GetOrgLecturePageGetResponses['lecturePage'] | null;
|
|
40
|
+
} & {
|
|
41
|
+
status: APIStatus;
|
|
42
|
+
refetch: (signal?: AbortSignal | undefined) => Promise<void>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var apiClient = require('@elice/api-client');
|
|
7
|
+
var types = require('@elice/types');
|
|
8
|
+
|
|
9
|
+
const MATERIAL_FETCH_KEY_MAP = Object.freeze({
|
|
10
|
+
[types.enums.LectureMaterialType.Nothing]: 'materialNothing',
|
|
11
|
+
[types.enums.LectureMaterialType.Note]: 'materialNote',
|
|
12
|
+
[types.enums.LectureMaterialType.Video]: 'materialVideo',
|
|
13
|
+
[types.enums.LectureMaterialType.PDF]: 'materialPdf',
|
|
14
|
+
[types.enums.LectureMaterialType.Exercise]: 'materialExercise',
|
|
15
|
+
[types.enums.LectureMaterialType.Quiz]: 'materialQuiz',
|
|
16
|
+
[types.enums.LectureMaterialType.Runbox]: 'materialRunbox',
|
|
17
|
+
[types.enums.LectureMaterialType.VideoFile]: 'materialVideoFile',
|
|
18
|
+
[types.enums.LectureMaterialType.Live]: 'materialLive',
|
|
19
|
+
[types.enums.LectureMaterialType.Assignment]: 'materialAssignment',
|
|
20
|
+
[types.enums.LectureMaterialType.LMSPublicContent]: 'materialLmsPublicContent',
|
|
21
|
+
[types.enums.LectureMaterialType.External]: 'materialExternal',
|
|
22
|
+
[types.enums.LectureMaterialType.Survey]: 'materialSurvey'
|
|
23
|
+
}); //
|
|
24
|
+
//
|
|
25
|
+
//
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Init api client and fetch material for contaner.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
32
|
+
* useMaterialFetchRaw(
|
|
33
|
+
* enums.LectureMaterialType.PDF,
|
|
34
|
+
* React.useCallback(
|
|
35
|
+
* signal =>
|
|
36
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
37
|
+
* { materialPdfId },
|
|
38
|
+
* { signal }
|
|
39
|
+
* ),
|
|
40
|
+
* [materialPdfId]
|
|
41
|
+
* ),
|
|
42
|
+
* isReady // boolean
|
|
43
|
+
* );
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
const useMaterialFetchRaw = (materialType, materialFetchFn, isReady = true) => {
|
|
47
|
+
const _return = React.useRef({});
|
|
48
|
+
|
|
49
|
+
const materialKey = MATERIAL_FETCH_KEY_MAP[materialType];
|
|
50
|
+
|
|
51
|
+
const _createEmptyFetchRes = () => ({
|
|
52
|
+
[materialKey]: null,
|
|
53
|
+
materialLecturePage: null
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const [matFetchRes, setMatFetchRes] = React.useState(_createEmptyFetchRes);
|
|
57
|
+
const [matFetchStatus, setMatFetchStatus] = React.useState('idle');
|
|
58
|
+
/**
|
|
59
|
+
* fetch material and lecture page
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
const fetch = React.useCallback(async signal => {
|
|
63
|
+
setMatFetchStatus('pending');
|
|
64
|
+
return materialFetchFn(signal).then(resMaterialGet => resMaterialGet[materialKey]).then(material => Promise.all([material, apiClient.getOrgLecturePageResolve({
|
|
65
|
+
materialId: material.id,
|
|
66
|
+
materialType
|
|
67
|
+
}, {
|
|
68
|
+
signal: signal
|
|
69
|
+
}).then(resLecturePageResolve => apiClient.getOrgLecturePageGet({
|
|
70
|
+
lecturePageId: resLecturePageResolve.lecturePageId
|
|
71
|
+
}, {
|
|
72
|
+
signal: signal
|
|
73
|
+
})).then(resLecturePageGet => resLecturePageGet.lecturePage)])).then(([material, materialLecturePage]) => {
|
|
74
|
+
setMatFetchRes({
|
|
75
|
+
[materialKey]: material,
|
|
76
|
+
materialLecturePage
|
|
77
|
+
});
|
|
78
|
+
setMatFetchStatus('resolved');
|
|
79
|
+
}).catch(err => {
|
|
80
|
+
if (err.name !== 'AbortError') {
|
|
81
|
+
setMatFetchRes(_createEmptyFetchRes);
|
|
82
|
+
setMatFetchStatus('rejected');
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
+
[materialKey, materialFetchFn]); //
|
|
87
|
+
// emit `fetch` when `isReady` is changed
|
|
88
|
+
//
|
|
89
|
+
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
if (!isReady) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const abortCtrl = new AbortController();
|
|
96
|
+
fetch(abortCtrl.signal).catch(() => void 0);
|
|
97
|
+
return () => {
|
|
98
|
+
abortCtrl.abort();
|
|
99
|
+
};
|
|
100
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
|
+
[isReady, fetch]); //
|
|
102
|
+
//
|
|
103
|
+
//
|
|
104
|
+
|
|
105
|
+
_return.current[materialKey] = matFetchRes[materialKey];
|
|
106
|
+
_return.current.materialLecturePage = matFetchRes.materialLecturePage;
|
|
107
|
+
_return.current.status = matFetchStatus;
|
|
108
|
+
_return.current.refetch = fetch;
|
|
109
|
+
return _return.current;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
exports.useMaterialFetchRaw = useMaterialFetchRaw;
|
package/es/index.js
CHANGED
|
@@ -5,5 +5,5 @@ export { useMaterialConfig } from './material-config/useMaterialConfig.js';
|
|
|
5
5
|
export { useMaterialConfigApiClientUpdate } from './material-config/useMaterialConfigApiClientUpdate.js';
|
|
6
6
|
export { updateMaterialConfigSessionKey } from './material-config/utils.js';
|
|
7
7
|
export { useMaterialFetch } from './material-fetch/useMaterialFetch.js';
|
|
8
|
-
export {
|
|
8
|
+
export { useMaterialFetchRaw } from './material-fetch/useMaterialFetchRaw.js';
|
|
9
9
|
export { withForwardRefMaterial, withMaterial } from './material-hoc/withMaterial.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './useMaterialFetch';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './useMaterialFetchRaw';
|
|
@@ -1,21 +1,70 @@
|
|
|
1
|
-
import type { EliceApiResponse } from '@elice/api-client';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { EliceApiClientConfigs, EliceApiResponse } from '@elice/api-client';
|
|
2
|
+
import type { enums } from '@elice/types';
|
|
3
|
+
import type { FetchKeyMap } from './useMaterialFetchRaw';
|
|
4
|
+
declare type FetchClientInitializer = (config: EliceApiClientConfigs) => void;
|
|
4
5
|
/**
|
|
5
6
|
* Init api client and fetch material for contaner.
|
|
6
7
|
*
|
|
7
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
8
|
-
* @param isReady Is ready to fetch material.
|
|
9
|
-
*
|
|
10
8
|
* @example
|
|
11
|
-
* const
|
|
12
|
-
* useMaterialFetch
|
|
9
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
10
|
+
* useMaterialFetch(
|
|
11
|
+
* enums.LectureMaterialType.PDF,
|
|
13
12
|
* React.useCallback(
|
|
14
|
-
* signal =>
|
|
13
|
+
* signal =>
|
|
14
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
15
|
+
* { materialPdfId },
|
|
16
|
+
* { signal }
|
|
17
|
+
* ),
|
|
15
18
|
* [materialPdfId]
|
|
16
19
|
* ),
|
|
17
|
-
*
|
|
20
|
+
* eliceApiClientConfigs.init
|
|
18
21
|
* );
|
|
19
22
|
*/
|
|
20
|
-
export declare const useMaterialFetch: <R = any
|
|
23
|
+
export declare const useMaterialFetch: <MT extends enums.LectureMaterialType, R extends Record<FetchKeyMap[MT], Record<string, any>> = Record<FetchKeyMap[MT], Record<string, any>>>(materialType: MT, materialFetchFn: (signal?: AbortSignal | undefined) => Promise<EliceApiResponse<R>>, init: FetchClientInitializer) => Record<FetchKeyMap[MT], R[FetchKeyMap[MT]] | null> & {
|
|
24
|
+
materialLecturePage: {
|
|
25
|
+
certificateDescription: string | null;
|
|
26
|
+
certificateFileUrl: string | null;
|
|
27
|
+
certificateTitle: string | null;
|
|
28
|
+
closeDatetime: number | null;
|
|
29
|
+
closeScheduleDatetime: number | null;
|
|
30
|
+
courseId: number;
|
|
31
|
+
createdDatetime: number;
|
|
32
|
+
id: number;
|
|
33
|
+
isCertificateEnabled: boolean;
|
|
34
|
+
isCompleted: boolean;
|
|
35
|
+
isEnrolledStudentResponded: boolean;
|
|
36
|
+
isForStats: boolean;
|
|
37
|
+
isGraded: boolean;
|
|
38
|
+
isLibraryInstance: boolean;
|
|
39
|
+
isOpened: boolean;
|
|
40
|
+
isResponded: boolean;
|
|
41
|
+
lectureGroupType: enums.LectureGroupType | null;
|
|
42
|
+
lectureId: number;
|
|
43
|
+
mainOrderNo: number;
|
|
44
|
+
materialId: number;
|
|
45
|
+
materialKey: string;
|
|
46
|
+
materialType: enums.LectureMaterialType;
|
|
47
|
+
modifiedDatetime: number;
|
|
48
|
+
openScheduleDatetime: number | null;
|
|
49
|
+
originCourse: {
|
|
50
|
+
id: number;
|
|
51
|
+
title: string;
|
|
52
|
+
organization: {
|
|
53
|
+
id: number;
|
|
54
|
+
name: string;
|
|
55
|
+
nameShort: string;
|
|
56
|
+
};
|
|
57
|
+
} | null;
|
|
58
|
+
originLecturePageId: number | null;
|
|
59
|
+
point: number;
|
|
60
|
+
score: number;
|
|
61
|
+
subLecturePageIds: number[];
|
|
62
|
+
subOrderNo: number | null;
|
|
63
|
+
taglist: string[];
|
|
64
|
+
title: string;
|
|
65
|
+
} | null;
|
|
66
|
+
} & {
|
|
67
|
+
status: import("@elice/material-shared-types").APIStatus;
|
|
68
|
+
refetch: (signal?: AbortSignal | undefined) => Promise<void>;
|
|
69
|
+
};
|
|
21
70
|
export {};
|
|
@@ -1,47 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../material-config/MaterialConfigContext.js';
|
|
3
|
+
import { useMaterialConfigApiClientUpdate } from '../material-config/useMaterialConfigApiClientUpdate.js';
|
|
4
|
+
import { useMaterialFetchRaw } from './useMaterialFetchRaw.js';
|
|
5
|
+
|
|
6
|
+
//
|
|
7
|
+
//
|
|
2
8
|
|
|
3
9
|
/**
|
|
4
10
|
* Init api client and fetch material for contaner.
|
|
5
11
|
*
|
|
6
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
7
|
-
* @param isReady Is ready to fetch material.
|
|
8
|
-
*
|
|
9
12
|
* @example
|
|
10
|
-
* const
|
|
11
|
-
* useMaterialFetch
|
|
13
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
14
|
+
* useMaterialFetch(
|
|
15
|
+
* enums.LectureMaterialType.PDF,
|
|
12
16
|
* React.useCallback(
|
|
13
|
-
* signal =>
|
|
17
|
+
* signal =>
|
|
18
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
19
|
+
* { materialPdfId },
|
|
20
|
+
* { signal }
|
|
21
|
+
* ),
|
|
14
22
|
* [materialPdfId]
|
|
15
23
|
* ),
|
|
16
|
-
*
|
|
24
|
+
* eliceApiClientConfigs.init
|
|
17
25
|
* );
|
|
18
26
|
*/
|
|
19
27
|
|
|
20
|
-
const useMaterialFetch = (
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (!isReady) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setMaterial(null);
|
|
29
|
-
setMaterialStatus('pending');
|
|
30
|
-
const abortCtrl = new AbortController();
|
|
31
|
-
fn(abortCtrl.signal).then(res => {
|
|
32
|
-
setMaterial(res);
|
|
33
|
-
setMaterialStatus('resolved');
|
|
34
|
-
}).catch(err => {
|
|
35
|
-
if (err.name !== 'AbortError') {
|
|
36
|
-
setMaterial(null);
|
|
37
|
-
setMaterialStatus('rejected');
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return () => {
|
|
41
|
-
abortCtrl.abort();
|
|
42
|
-
};
|
|
43
|
-
}, [isReady, fn]);
|
|
44
|
-
return [material, materialStatus];
|
|
28
|
+
const useMaterialFetch = (materialType, materialFetchFn, init) => {
|
|
29
|
+
const isReady = useMaterialConfigApiClientUpdate(init);
|
|
30
|
+
return useMaterialFetchRaw(materialType, materialFetchFn, isReady);
|
|
45
31
|
};
|
|
46
32
|
|
|
47
33
|
export { useMaterialFetch };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { enums } from '@elice/types';
|
|
2
|
+
import type { EliceApiResponse } from '@elice/api-client';
|
|
3
|
+
import type { APIStatus } from '@elice/material-shared-types';
|
|
4
|
+
import type { GetOrgLecturePageGetResponses } from '@elice/types';
|
|
5
|
+
export interface FetchKeyMap {
|
|
6
|
+
[enums.LectureMaterialType.Nothing]: 'materialNothing';
|
|
7
|
+
[enums.LectureMaterialType.Note]: 'materialNote';
|
|
8
|
+
[enums.LectureMaterialType.Video]: 'materialVideo';
|
|
9
|
+
[enums.LectureMaterialType.PDF]: 'materialPdf';
|
|
10
|
+
[enums.LectureMaterialType.Exercise]: 'materialExercise';
|
|
11
|
+
[enums.LectureMaterialType.Quiz]: 'materialQuiz';
|
|
12
|
+
[enums.LectureMaterialType.Runbox]: 'materialRunbox';
|
|
13
|
+
[enums.LectureMaterialType.VideoFile]: 'materialVideoFile';
|
|
14
|
+
[enums.LectureMaterialType.Live]: 'materialLive';
|
|
15
|
+
[enums.LectureMaterialType.Assignment]: 'materialAssignment';
|
|
16
|
+
[enums.LectureMaterialType.LMSPublicContent]: 'materialLmsPublicContent';
|
|
17
|
+
[enums.LectureMaterialType.External]: 'materialExternal';
|
|
18
|
+
[enums.LectureMaterialType.Survey]: 'materialSurvey';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Init api client and fetch material for contaner.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
25
|
+
* useMaterialFetchRaw(
|
|
26
|
+
* enums.LectureMaterialType.PDF,
|
|
27
|
+
* React.useCallback(
|
|
28
|
+
* signal =>
|
|
29
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
30
|
+
* { materialPdfId },
|
|
31
|
+
* { signal }
|
|
32
|
+
* ),
|
|
33
|
+
* [materialPdfId]
|
|
34
|
+
* ),
|
|
35
|
+
* isReady // boolean
|
|
36
|
+
* );
|
|
37
|
+
*/
|
|
38
|
+
export declare const useMaterialFetchRaw: <MT extends enums.LectureMaterialType, R extends Record<FetchKeyMap[MT], Record<string, any>> = Record<FetchKeyMap[MT], Record<string, any>>>(materialType: MT, materialFetchFn: (signal?: AbortSignal | undefined) => Promise<EliceApiResponse<R>>, isReady?: boolean) => Record<FetchKeyMap[MT], R[FetchKeyMap[MT]] | null> & {
|
|
39
|
+
materialLecturePage: GetOrgLecturePageGetResponses['lecturePage'] | null;
|
|
40
|
+
} & {
|
|
41
|
+
status: APIStatus;
|
|
42
|
+
refetch: (signal?: AbortSignal | undefined) => Promise<void>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { getOrgLecturePageResolve, getOrgLecturePageGet } from '@elice/api-client';
|
|
3
|
+
import { enums } from '@elice/types';
|
|
4
|
+
|
|
5
|
+
const MATERIAL_FETCH_KEY_MAP = Object.freeze({
|
|
6
|
+
[enums.LectureMaterialType.Nothing]: 'materialNothing',
|
|
7
|
+
[enums.LectureMaterialType.Note]: 'materialNote',
|
|
8
|
+
[enums.LectureMaterialType.Video]: 'materialVideo',
|
|
9
|
+
[enums.LectureMaterialType.PDF]: 'materialPdf',
|
|
10
|
+
[enums.LectureMaterialType.Exercise]: 'materialExercise',
|
|
11
|
+
[enums.LectureMaterialType.Quiz]: 'materialQuiz',
|
|
12
|
+
[enums.LectureMaterialType.Runbox]: 'materialRunbox',
|
|
13
|
+
[enums.LectureMaterialType.VideoFile]: 'materialVideoFile',
|
|
14
|
+
[enums.LectureMaterialType.Live]: 'materialLive',
|
|
15
|
+
[enums.LectureMaterialType.Assignment]: 'materialAssignment',
|
|
16
|
+
[enums.LectureMaterialType.LMSPublicContent]: 'materialLmsPublicContent',
|
|
17
|
+
[enums.LectureMaterialType.External]: 'materialExternal',
|
|
18
|
+
[enums.LectureMaterialType.Survey]: 'materialSurvey'
|
|
19
|
+
}); //
|
|
20
|
+
//
|
|
21
|
+
//
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Init api client and fetch material for contaner.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const { materialPdf, materialLecturePage, status ] =
|
|
28
|
+
* useMaterialFetchRaw(
|
|
29
|
+
* enums.LectureMaterialType.PDF,
|
|
30
|
+
* React.useCallback(
|
|
31
|
+
* signal =>
|
|
32
|
+
* getOrgMaterialPdfGet<GetOrgMaterialPdfGetResponses>(
|
|
33
|
+
* { materialPdfId },
|
|
34
|
+
* { signal }
|
|
35
|
+
* ),
|
|
36
|
+
* [materialPdfId]
|
|
37
|
+
* ),
|
|
38
|
+
* isReady // boolean
|
|
39
|
+
* );
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const useMaterialFetchRaw = (materialType, materialFetchFn, isReady = true) => {
|
|
43
|
+
const _return = useRef({});
|
|
44
|
+
|
|
45
|
+
const materialKey = MATERIAL_FETCH_KEY_MAP[materialType];
|
|
46
|
+
|
|
47
|
+
const _createEmptyFetchRes = () => ({
|
|
48
|
+
[materialKey]: null,
|
|
49
|
+
materialLecturePage: null
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const [matFetchRes, setMatFetchRes] = useState(_createEmptyFetchRes);
|
|
53
|
+
const [matFetchStatus, setMatFetchStatus] = useState('idle');
|
|
54
|
+
/**
|
|
55
|
+
* fetch material and lecture page
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
const fetch = useCallback(async signal => {
|
|
59
|
+
setMatFetchStatus('pending');
|
|
60
|
+
return materialFetchFn(signal).then(resMaterialGet => resMaterialGet[materialKey]).then(material => Promise.all([material, getOrgLecturePageResolve({
|
|
61
|
+
materialId: material.id,
|
|
62
|
+
materialType
|
|
63
|
+
}, {
|
|
64
|
+
signal: signal
|
|
65
|
+
}).then(resLecturePageResolve => getOrgLecturePageGet({
|
|
66
|
+
lecturePageId: resLecturePageResolve.lecturePageId
|
|
67
|
+
}, {
|
|
68
|
+
signal: signal
|
|
69
|
+
})).then(resLecturePageGet => resLecturePageGet.lecturePage)])).then(([material, materialLecturePage]) => {
|
|
70
|
+
setMatFetchRes({
|
|
71
|
+
[materialKey]: material,
|
|
72
|
+
materialLecturePage
|
|
73
|
+
});
|
|
74
|
+
setMatFetchStatus('resolved');
|
|
75
|
+
}).catch(err => {
|
|
76
|
+
if (err.name !== 'AbortError') {
|
|
77
|
+
setMatFetchRes(_createEmptyFetchRes);
|
|
78
|
+
setMatFetchStatus('rejected');
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
[materialKey, materialFetchFn]); //
|
|
83
|
+
// emit `fetch` when `isReady` is changed
|
|
84
|
+
//
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!isReady) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const abortCtrl = new AbortController();
|
|
92
|
+
fetch(abortCtrl.signal).catch(() => void 0);
|
|
93
|
+
return () => {
|
|
94
|
+
abortCtrl.abort();
|
|
95
|
+
};
|
|
96
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
97
|
+
[isReady, fetch]); //
|
|
98
|
+
//
|
|
99
|
+
//
|
|
100
|
+
|
|
101
|
+
_return.current[materialKey] = matFetchRes[materialKey];
|
|
102
|
+
_return.current.materialLecturePage = matFetchRes.materialLecturePage;
|
|
103
|
+
_return.current.status = matFetchStatus;
|
|
104
|
+
_return.current.refetch = fetch;
|
|
105
|
+
return _return.current;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export { useMaterialFetchRaw };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-shared-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.230306.0",
|
|
4
4
|
"description": "Shared typings for elice material projects",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@elice/api-client": "1.
|
|
32
|
+
"@elice/api-client": "^1.230306.0",
|
|
33
33
|
"@elice/material-shared-types": "22.7.2-1",
|
|
34
34
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
35
35
|
"react-use": "^17.0.0",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"tslib": "^2.3.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@elice/api-client": "1.
|
|
43
|
-
"@elice/material-shared-types": "1.
|
|
44
|
-
"@elice/types": "1.
|
|
42
|
+
"@elice/api-client": "^1.230306.0",
|
|
43
|
+
"@elice/material-shared-types": "1.230306.0",
|
|
44
|
+
"@elice/types": "^1.230306.0",
|
|
45
45
|
"@types/react": "~17.0.9",
|
|
46
46
|
"react-use": "^17.2.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "2ba30b7324d9fd782970a0343a6573827159b737"
|
|
49
49
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { EliceApiClientConfigs, EliceApiResponse } from '@elice/api-client';
|
|
2
|
-
import type { APIStatus } from '@elice/material-shared-types';
|
|
3
|
-
declare type ApiInitFn = (config: EliceApiClientConfigs) => void;
|
|
4
|
-
declare type FetchFn<R> = (signal: AbortSignal) => Promise<EliceApiResponse<R>>;
|
|
5
|
-
/**
|
|
6
|
-
* Init api client and fetch material for contaner.
|
|
7
|
-
*
|
|
8
|
-
* @param init Init api client.
|
|
9
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const [materialPdf, materialPdfStatus] =
|
|
13
|
-
* useMaterialInitFetch<GetOrgMaterialPdfGetResponses>(
|
|
14
|
-
* eliceApiClientConfigs.init,
|
|
15
|
-
* React.useCallback(
|
|
16
|
-
* signal => getOrgMaterialPdfGet({ materialPdfId }, { signal }),
|
|
17
|
-
* [materialPdfId]
|
|
18
|
-
* ),
|
|
19
|
-
* );
|
|
20
|
-
*/
|
|
21
|
-
export declare const useMaterialInitFetch: <R = any>(init: ApiInitFn, fn: FetchFn<R>) => [R | null, APIStatus];
|
|
22
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
require('../material-config/MaterialConfigContext.js');
|
|
7
|
-
var useMaterialConfigApiClientUpdate = require('../material-config/useMaterialConfigApiClientUpdate.js');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Init api client and fetch material for contaner.
|
|
11
|
-
*
|
|
12
|
-
* @param init Init api client.
|
|
13
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* const [materialPdf, materialPdfStatus] =
|
|
17
|
-
* useMaterialInitFetch<GetOrgMaterialPdfGetResponses>(
|
|
18
|
-
* eliceApiClientConfigs.init,
|
|
19
|
-
* React.useCallback(
|
|
20
|
-
* signal => getOrgMaterialPdfGet({ materialPdfId }, { signal }),
|
|
21
|
-
* [materialPdfId]
|
|
22
|
-
* ),
|
|
23
|
-
* );
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const useMaterialInitFetch = (init, fn) => {
|
|
27
|
-
const [material, setMaterial] = React.useState(null);
|
|
28
|
-
const [materialStatus, setMaterialStatus] = React.useState('idle');
|
|
29
|
-
const isReady = useMaterialConfigApiClientUpdate.useMaterialConfigApiClientUpdate(init);
|
|
30
|
-
React.useEffect(() => {
|
|
31
|
-
if (!isReady) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
setMaterial(null);
|
|
36
|
-
setMaterialStatus('pending');
|
|
37
|
-
const abortCtrl = new AbortController();
|
|
38
|
-
fn(abortCtrl.signal).then(res => {
|
|
39
|
-
setMaterial(res);
|
|
40
|
-
setMaterialStatus('resolved');
|
|
41
|
-
}).catch(err => {
|
|
42
|
-
if (err.name !== 'AbortError') {
|
|
43
|
-
setMaterial(null);
|
|
44
|
-
setMaterialStatus('rejected');
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return () => {
|
|
48
|
-
abortCtrl.abort();
|
|
49
|
-
};
|
|
50
|
-
}, [isReady, fn]);
|
|
51
|
-
return [material, materialStatus];
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
exports.useMaterialInitFetch = useMaterialInitFetch;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { EliceApiClientConfigs, EliceApiResponse } from '@elice/api-client';
|
|
2
|
-
import type { APIStatus } from '@elice/material-shared-types';
|
|
3
|
-
declare type ApiInitFn = (config: EliceApiClientConfigs) => void;
|
|
4
|
-
declare type FetchFn<R> = (signal: AbortSignal) => Promise<EliceApiResponse<R>>;
|
|
5
|
-
/**
|
|
6
|
-
* Init api client and fetch material for contaner.
|
|
7
|
-
*
|
|
8
|
-
* @param init Init api client.
|
|
9
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const [materialPdf, materialPdfStatus] =
|
|
13
|
-
* useMaterialInitFetch<GetOrgMaterialPdfGetResponses>(
|
|
14
|
-
* eliceApiClientConfigs.init,
|
|
15
|
-
* React.useCallback(
|
|
16
|
-
* signal => getOrgMaterialPdfGet({ materialPdfId }, { signal }),
|
|
17
|
-
* [materialPdfId]
|
|
18
|
-
* ),
|
|
19
|
-
* );
|
|
20
|
-
*/
|
|
21
|
-
export declare const useMaterialInitFetch: <R = any>(init: ApiInitFn, fn: FetchFn<R>) => [R | null, APIStatus];
|
|
22
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import '../material-config/MaterialConfigContext.js';
|
|
3
|
-
import { useMaterialConfigApiClientUpdate } from '../material-config/useMaterialConfigApiClientUpdate.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Init api client and fetch material for contaner.
|
|
7
|
-
*
|
|
8
|
-
* @param init Init api client.
|
|
9
|
-
* @param fn API client wrapped with `React.useCallback` to fetch material.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const [materialPdf, materialPdfStatus] =
|
|
13
|
-
* useMaterialInitFetch<GetOrgMaterialPdfGetResponses>(
|
|
14
|
-
* eliceApiClientConfigs.init,
|
|
15
|
-
* React.useCallback(
|
|
16
|
-
* signal => getOrgMaterialPdfGet({ materialPdfId }, { signal }),
|
|
17
|
-
* [materialPdfId]
|
|
18
|
-
* ),
|
|
19
|
-
* );
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
const useMaterialInitFetch = (init, fn) => {
|
|
23
|
-
const [material, setMaterial] = useState(null);
|
|
24
|
-
const [materialStatus, setMaterialStatus] = useState('idle');
|
|
25
|
-
const isReady = useMaterialConfigApiClientUpdate(init);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!isReady) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
setMaterial(null);
|
|
32
|
-
setMaterialStatus('pending');
|
|
33
|
-
const abortCtrl = new AbortController();
|
|
34
|
-
fn(abortCtrl.signal).then(res => {
|
|
35
|
-
setMaterial(res);
|
|
36
|
-
setMaterialStatus('resolved');
|
|
37
|
-
}).catch(err => {
|
|
38
|
-
if (err.name !== 'AbortError') {
|
|
39
|
-
setMaterial(null);
|
|
40
|
-
setMaterialStatus('rejected');
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return () => {
|
|
44
|
-
abortCtrl.abort();
|
|
45
|
-
};
|
|
46
|
-
}, [isReady, fn]);
|
|
47
|
-
return [material, materialStatus];
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { useMaterialInitFetch };
|