@stackfactor/client-api 1.1.26 → 1.1.27
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/lib/microSkillsQuizes.js +30 -6
- package/package.json +1 -1
package/lib/microSkillsQuizes.js
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import { client } from "./axiosClient.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Get responses for a microskill quiz
|
|
5
|
+
* @param {String} microSkill
|
|
6
|
+
* @param {String} token
|
|
7
|
+
* @returns {Promise}
|
|
8
|
+
*/
|
|
9
|
+
const generateQuestions = (microSkill, token) => {
|
|
10
|
+
return new Promise(function (resolve, reject) {
|
|
11
|
+
let data = {
|
|
12
|
+
microSkill: microSkill,
|
|
13
|
+
};
|
|
14
|
+
let confirmationRequest = client.post(
|
|
15
|
+
`api/v1/microskillsresponses/generatequestions`,
|
|
16
|
+
data,
|
|
17
|
+
{
|
|
18
|
+
headers: { authorization: token },
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
confirmationRequest
|
|
22
|
+
.then((response) => {
|
|
23
|
+
resolve(response.data);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
reject(error);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
3
31
|
/**
|
|
4
32
|
* Get responses for a microskill quiz
|
|
5
33
|
* @param {String} learningContentId
|
|
@@ -33,12 +61,7 @@ const getResponses = (learningContentId, microSkillId, token) => {
|
|
|
33
61
|
* @param {String} token Authorization token
|
|
34
62
|
* @returns {Promise}
|
|
35
63
|
*/
|
|
36
|
-
|
|
37
|
-
learningContentId,
|
|
38
|
-
microSkillId,
|
|
39
|
-
responses,
|
|
40
|
-
token
|
|
41
|
-
) => {
|
|
64
|
+
const saveResponses = (learningContentId, microSkillId, responses, token) => {
|
|
42
65
|
return new Promise(function (resolve, reject) {
|
|
43
66
|
let data = {
|
|
44
67
|
responses: responses,
|
|
@@ -61,6 +84,7 @@ export const saveResponses = (
|
|
|
61
84
|
};
|
|
62
85
|
|
|
63
86
|
const microSkillsQuizes = {
|
|
87
|
+
generateQuestions,
|
|
64
88
|
getResponses,
|
|
65
89
|
saveResponses,
|
|
66
90
|
};
|