add: guard in router
This commit is contained in:
@@ -3,9 +3,18 @@
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
import Swal from 'sweetalert2';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useCompanyStore } from '../stores/company';
|
||||
import { useVehiclesStore } from '../stores/vehicles';
|
||||
import { useLoadsStore } from '../stores/loads';
|
||||
import { useNotificationsStore } from '../stores/notifications';
|
||||
|
||||
const route = useRoute();
|
||||
const auth = useAuthStore();
|
||||
const company = useCompanyStore();
|
||||
const vehicles = useVehiclesStore();
|
||||
const loads = useLoadsStore();
|
||||
const noty = useNotificationsStore();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n()
|
||||
|
||||
const handleLogout = () => {
|
||||
@@ -20,6 +29,11 @@
|
||||
}).then(async(result) => {
|
||||
if(result.isConfirmed) {
|
||||
auth.logout();
|
||||
company.clear();
|
||||
vehicles.clear();
|
||||
loads.clear();
|
||||
noty.clear();
|
||||
router.push({name: 'login'});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user