@mouseless/baked 1.0.0 → 1.0.1
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/dist/module.json
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
<div class="text-2xl">
|
|
17
17
|
{{ l(errorInfo.message) }}
|
|
18
18
|
</div>
|
|
19
|
-
<AuthorizedContent>
|
|
19
|
+
<AuthorizedContent v-if="errorInfo.showSafeLinks">
|
|
20
20
|
<div class="text-2xl">
|
|
21
21
|
{{ l(safeLinksMessage) }}
|
|
22
22
|
</div>
|
|
23
23
|
</AuthorizedContent>
|
|
24
24
|
</div>
|
|
25
|
-
<AuthorizedContent>
|
|
25
|
+
<AuthorizedContent v-if="errorInfo.showSafeLinks">
|
|
26
26
|
<Divider
|
|
27
27
|
type="dashed"
|
|
28
28
|
class="my-8"
|
|
@@ -61,5 +61,17 @@ const statusCode = computed(() => {
|
|
|
61
61
|
const code = data.value?.data?.status ?? data.value?.statusCode ?? 999;
|
|
62
62
|
return code === 999 ? "APP" : code;
|
|
63
63
|
});
|
|
64
|
-
const errorInfo = computed(() =>
|
|
64
|
+
const errorInfo = computed(() => {
|
|
65
|
+
let result = errorInfos[`${statusCode.value}`];
|
|
66
|
+
if (!result) {
|
|
67
|
+
return errorInfos["999"];
|
|
68
|
+
}
|
|
69
|
+
if (result.customMessage) {
|
|
70
|
+
result = {
|
|
71
|
+
...result,
|
|
72
|
+
message: data.value?.data?.detail ?? data.value?.message ?? result.message
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
});
|
|
65
77
|
</script>
|
|
@@ -61,10 +61,22 @@ export default function() {
|
|
|
61
61
|
globalThis.addEventListener("token-changed", callback);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
function offChanged(callback) {
|
|
65
|
+
globalThis.removeEventListener("token-changed", callback);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function decode(value) {
|
|
69
|
+
const { access } = JSON.parse(value);
|
|
70
|
+
|
|
71
|
+
return JSON.parse(atob(access.split(".")[1]));
|
|
72
|
+
}
|
|
73
|
+
|
|
64
74
|
return {
|
|
65
75
|
current,
|
|
66
76
|
setCurrent,
|
|
67
|
-
onChanged
|
|
77
|
+
onChanged,
|
|
78
|
+
offChanged,
|
|
79
|
+
decode
|
|
68
80
|
};
|
|
69
81
|
};
|
|
70
82
|
|