start frant 050228

This commit is contained in:
2026-05-18 20:18:28 +03:30
parent 26e59e03e0
commit cb65e5e601
33 changed files with 1493 additions and 425 deletions
+7 -1
View File
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia';
import { ref, computed } from 'vue';
import { computed, ref } from 'vue';
import type { User } from '@/api/auth';
import { fetchMe } from '@/api/auth';
@@ -10,6 +10,9 @@ export const useAuthStore = defineStore('auth', () => {
const user = ref<User | null>(null);
const isLoggedIn = computed(() => Boolean(token.value));
const isAdmin = computed(() => user.value?.role === 'admin');
const isBusinessOwner = computed(() => user.value?.role === 'business_owner');
const isCustomer = computed(() => user.value?.role === 'customer');
function setSession(accessToken: string, profile: User) {
token.value = accessToken;
@@ -38,6 +41,9 @@ export const useAuthStore = defineStore('auth', () => {
token,
user,
isLoggedIn,
isAdmin,
isBusinessOwner,
isCustomer,
setSession,
logout,
loadUser,