File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -74,10 +74,16 @@ const router = createRouter({
7474// BEGIN: be15d9bcejpp
7575router . beforeEach ( async ( to ) => {
7676 // redirect to login page if not logged in and trying to access a restricted page
77- const publicPages = [ "/" , "/registerConfirm" ] ;
77+ const publicPages = [ "/" ] ;
7878 const authRequired = ! publicPages . includes ( to . path ) ;
7979 const auth = useAuthStore ( ) ;
8080
81+ // Logout on reload
82+ const role = useRoleStore ( ) ;
83+ if ( auth . user && role . captainsId . length === 0 && role . customersIdWhereIgotRights . length === 0 ) {
84+ auth . logout ( ) ;
85+ }
86+
8187 if ( authRequired && ! auth . user ) {
8288 auth . returnedUrl = to . fullPath ;
8389 return "/" ;
Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import PageContentHeader from " @/ui/components/PageContentHeader.vue" ;
33import PageContentLayout from " @/ui/layouts/PageContentLayout.vue" ;
4- import router from " @/router/router" ;
54import buttonSecondary from " @/ui/components/buttons/ButtonSecondary.vue" ;
65import LanguageSwitch from " ../components/LanguageSwitch.vue" ;
6+ import { useAuthStore } from " @/stores/authStore" ;
77
88const logOff = () => {
9- router .push (" /" );
9+ const authStore = useAuthStore ();
10+ authStore .logout ();
1011};
1112 </script >
1213
You can’t perform that action at this time.
0 commit comments