added: login, logout and auto refresh token

This commit is contained in:
nquidox 2025-09-10 23:29:27 +03:00
parent 72c796c429
commit f66c014a36
9 changed files with 189 additions and 63 deletions

View file

@ -1,7 +0,0 @@
<script setup>
</script>
<template>
Home view
</template>

View file

@ -1,16 +1,16 @@
<script setup lang="js">
import { ref } from 'vue';
import { useAuthStore} from '@/stores/authStore.js';
<script setup>
import { ref } from 'vue'
import { useAuthStore} from '@/stores/authStore.js'
const store = useAuthStore();
const store = useAuthStore()
const email = ref('');
const password = ref('');
const email = ref('')
const password = ref('')
const onSubmit = () => {
store.login(email.value, password.value);
};
store.login(email.value, password.value)
}
</script>
<template>
@ -35,5 +35,7 @@
</template>
<style scoped>
div {
background: red;
}
</style>

View file

@ -0,0 +1,20 @@
<script setup>
import { useAuthStore } from '@/stores/authStore.js'
const store = useAuthStore()
const logout = () => {
store.logout()
}
</script>
<template>
<div>Home view</div>
<button type="button" @click="logout">no route</button>
</template>
<style scoped>
div {
background: green;
}
</style>