@capytale/meta-player 0.3.9 → 0.3.10
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/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export const useReset = (props: UseResetProps) => {
|
|
|
20
20
|
if (mode !== "assignment" || workflow !== "current") {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
return async () => {
|
|
23
|
+
return async (reload: boolean = true) => {
|
|
24
24
|
if (!activityJs.activitySession) {
|
|
25
25
|
throw new Error("No activity session to reset");
|
|
26
26
|
}
|
|
@@ -36,26 +36,34 @@ export const useReset = (props: UseResetProps) => {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
dispatch(setSaveState("saving"));
|
|
39
40
|
try {
|
|
40
|
-
dispatch(setSaveState("saving"));
|
|
41
41
|
const ab = activityJs.activitySession.activityBunch;
|
|
42
42
|
// @ts-expect-error
|
|
43
|
-
ab.assignmentNode
|
|
43
|
+
if (ab.assignmentNode!.content.value != null) {
|
|
44
|
+
// @ts-expect-error
|
|
45
|
+
ab.assignmentNode.content.value = null;
|
|
46
|
+
}
|
|
44
47
|
// @ts-expect-error
|
|
45
|
-
ab.assignmentNode
|
|
48
|
+
if (ab.assignmentNode!.binaryData?.value != null) {
|
|
49
|
+
// @ts-expect-error
|
|
50
|
+
ab.assignmentNode.binaryData.value = null;
|
|
51
|
+
}
|
|
46
52
|
try {
|
|
47
53
|
const saveData = await ab.save();
|
|
48
54
|
console.log("Save return data", saveData);
|
|
49
|
-
|
|
55
|
+
if (reload) {
|
|
56
|
+
location.reload();
|
|
57
|
+
}
|
|
50
58
|
} catch (e) {
|
|
51
59
|
console.error("Error in reset", e);
|
|
52
60
|
props.onError((e as any).toString());
|
|
53
61
|
return;
|
|
54
62
|
}
|
|
55
|
-
dispatch(setSaveState("idle"));
|
|
56
63
|
} catch (e) {
|
|
57
64
|
console.error("Error in reset process", e);
|
|
58
65
|
props.onError((e as any).toString());
|
|
59
66
|
}
|
|
67
|
+
dispatch(setSaveState("idle"));
|
|
60
68
|
};
|
|
61
69
|
};
|