Open serynabatov opened 4 months ago
The previous functionality
<script setup> import { watch, ref } from "vue"; import { useRoute } from "vue-router"; const login = ref(false); const route = useRoute(); watch( () => route.fullPath, async () => { console.log("changed"); console.log(localStorage.id); if ((localStorage.getItem("id") === null) (localStorage.id == 0)) { localStorage.id = 0; login.value = 0; } else { login.value = 1; } } ); if ((localStorage.getItem("id") === null) (localStorage.id == 0)) { localStorage.id = 0; } else { login.value = 1; } </script>
It should be migrated to https://router.vuejs.org/guide/advanced/navigation-guards.html
The previous functionality
It should be migrated to https://router.vuejs.org/guide/advanced/navigation-guards.html