1
0

PWA модуль

Теперь проект может быть установлен как приложение на телефон
This commit is contained in:
2026-01-16 16:12:34 +07:00
parent 25663a7aa4
commit c46fd3952e
16 changed files with 5388 additions and 52 deletions

View File

@@ -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