PWA модуль
Теперь проект может быть установлен как приложение на телефон
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import { projectsApi, usersApi, authApi, cardsApi } from '../api'
|
||||
import { projectsApi, usersApi, cardsApi } from '../api'
|
||||
import { getCachedUser } from '../router'
|
||||
|
||||
export const useProjectsStore = defineStore('projects', () => {
|
||||
// ==================== СОСТОЯНИЕ ====================
|
||||
@@ -94,12 +95,14 @@ export const useProjectsStore = defineStore('projects', () => {
|
||||
const usersData = await usersApi.getAll()
|
||||
if (usersData.success) users.value = usersData.data
|
||||
|
||||
// Загружаем текущего пользователя
|
||||
const authData = await authApi.check()
|
||||
if (authData.success && authData.user) {
|
||||
// Находим полные данные пользователя (с id) из списка users
|
||||
const fullUser = users.value.find(u => u.username === authData.user.username)
|
||||
currentUser.value = fullUser || authData.user
|
||||
// Получаем текущего пользователя из кэша роутера (без повторного запроса)
|
||||
if (!currentUser.value) {
|
||||
const cachedUser = getCachedUser()
|
||||
if (cachedUser) {
|
||||
// Находим полные данные пользователя (с id) из списка users
|
||||
const fullUser = users.value.find(u => u.username === cachedUser.username)
|
||||
currentUser.value = fullUser || cachedUser
|
||||
}
|
||||
}
|
||||
|
||||
initialized.value = true
|
||||
|
||||
Reference in New Issue
Block a user