Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 53dab12

Browse files
committed
Add debug
1 parent fd7f958 commit 53dab12

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

src/App.vue

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,33 @@ const userPermissions = computed(() => collection().userPermissions);
1111
1212
collection().loadUser();
1313
14-
watchEffect(() => {
15-
console.log("user.value=");
16-
console.log(JSON.stringify(user.value));
17-
if (user.value !== null) {
18-
if (!route.meta.public) {
19-
if (
20-
user.value &&
21-
!userPermissions.value?.some(
22-
({ privilege, role }) =>
23-
role === "EdgeCreator" &&
24-
["Edition", "Admin"].includes(privilege as string)
25-
)
26-
) {
27-
location.replace("/");
14+
watch(
15+
() => user.value,
16+
(newValue) => {
17+
console.log(`newValue=${JSON.stringify(newValue)}`);
18+
if (newValue !== null) {
19+
if (!route.meta.public) {
20+
if (
21+
newValue &&
22+
!userPermissions.value?.some(
23+
({ privilege, role }) =>
24+
role === "EdgeCreator" &&
25+
["Edition", "Admin"].includes(privilege as string)
26+
)
27+
) {
28+
location.replace("/");
29+
}
2830
}
31+
} else {
32+
location.replace(
33+
`${import.meta.env.VITE_DM_URL as string}/login?redirect=${
34+
window.location.href
35+
}`
36+
);
2937
}
30-
} else {
31-
location.replace(
32-
`${import.meta.env.VITE_DM_URL as string}/login?redirect=${
33-
window.location.href
34-
}`
35-
);
36-
}
37-
});
38+
},
39+
{ immediate: true }
40+
);
3841
</script>
3942

4043
<style lang="scss">

0 commit comments

Comments
 (0)