@stackfactor/client-api 1.1.24 → 1.1.25
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/exports.js +2 -0
- package/lib/microSkillsQuizes.js +68 -0
- package/package.json +1 -1
package/exports.js
CHANGED
|
@@ -24,6 +24,7 @@ import groups from "./lib/groups.js";
|
|
|
24
24
|
import learningContent from "./lib/learningContent.js";
|
|
25
25
|
import learningPath from "./lib/learningPath.js";
|
|
26
26
|
import logger from "./lib/logger.js";
|
|
27
|
+
import microSkillsQuizes from "./lib/microSkillsQuizes.js";
|
|
27
28
|
import role from "./lib/role.js";
|
|
28
29
|
import roleTemplate from "./lib/roleTemplate.js";
|
|
29
30
|
import skill from "./lib/skill.js";
|
|
@@ -55,6 +56,7 @@ export {
|
|
|
55
56
|
learningContent,
|
|
56
57
|
learningPath,
|
|
57
58
|
logger,
|
|
59
|
+
microSkillsQuizes,
|
|
58
60
|
PERMISSIONS,
|
|
59
61
|
PERMISSION_DESCRIPTIONS,
|
|
60
62
|
RESPONSE_TYPE,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get responses for a microskill quiz
|
|
5
|
+
* @param {String} learningContentId
|
|
6
|
+
* @param {String} microSkillId
|
|
7
|
+
* @param {String} token
|
|
8
|
+
* @returns {Promise}
|
|
9
|
+
*/
|
|
10
|
+
const getResponses = (learningContentId, microSkillId, token) => {
|
|
11
|
+
return new Promise(function (resolve, reject) {
|
|
12
|
+
let confirmationRequest = client.get(
|
|
13
|
+
`/api/v1/microskillsresponses/${learningContentId}/${microSkillId}`,
|
|
14
|
+
{
|
|
15
|
+
headers: { authorization: token },
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
confirmationRequest
|
|
19
|
+
.then((response) => {
|
|
20
|
+
resolve(response.data);
|
|
21
|
+
})
|
|
22
|
+
.catch((error) => {
|
|
23
|
+
reject(error);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Save responses for a microskill quiz
|
|
30
|
+
* @param {String} learningContentId
|
|
31
|
+
* @param {String} microSkillId
|
|
32
|
+
* @param {Array<Object>} responses
|
|
33
|
+
* @param {String} token Authorization token
|
|
34
|
+
* @returns {Promise}
|
|
35
|
+
*/
|
|
36
|
+
export const saveResponses = (
|
|
37
|
+
learningContentId,
|
|
38
|
+
microSkillId,
|
|
39
|
+
responses,
|
|
40
|
+
token
|
|
41
|
+
) => {
|
|
42
|
+
return new Promise(function (resolve, reject) {
|
|
43
|
+
let data = {
|
|
44
|
+
responses: responses,
|
|
45
|
+
};
|
|
46
|
+
let confirmationRequest = client.post(
|
|
47
|
+
`/api/v1/microskillsresponses/${learningContentId}/${microSkillId}`,
|
|
48
|
+
data,
|
|
49
|
+
{
|
|
50
|
+
headers: { authorization: token },
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
confirmationRequest
|
|
54
|
+
.then((response) => {
|
|
55
|
+
resolve(response.data);
|
|
56
|
+
})
|
|
57
|
+
.catch((error) => {
|
|
58
|
+
reject(error);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const microSkillsQuizes = {
|
|
64
|
+
getResponses,
|
|
65
|
+
saveResponses,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default microSkillsQuizes;
|