This repository was archived by the owner on Aug 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,30 +11,33 @@ const userPermissions = computed(() => collection().userPermissions);
1111
1212collection ().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">
You can’t perform that action at this time.
0 commit comments