@coopenomics/desktop 2025.11.17-alpha-3 → 2025.11.18-alpha-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/extensions/capital/features/Commit/CreateCommit/ui/CreateCommitButton.vue +4 -4
  2. package/extensions/capital/pages/ProjectsListPage/ui/ProjectsListPage.vue +3 -3
  3. package/package.json +6 -6
  4. package/src/app/layouts/useDefaultLayoutLogic.ts +1 -3
  5. package/src/entities/CmdkMenu/model/store.ts +16 -12
  6. package/src/entities/Desktop/model/store.ts +20 -16
  7. package/src/entities/Session/index.ts +0 -1
  8. package/src/entities/Session/model/store.ts +31 -0
  9. package/src/entities/User/index.ts +0 -3
  10. package/src/features/User/CreateUser/model/index.ts +1 -3
  11. package/src/features/User/LoginUser/model/index.ts +8 -11
  12. package/src/features/User/LoginUser/ui/LoginForm/LoginForm.vue +14 -5
  13. package/src/features/User/Logout/model/index.ts +3 -3
  14. package/src/features/User/Logout/ui/LogoutButton/LogoutButton.vue +1 -3
  15. package/src/pages/Cooperative/ListOfAgenda/ui/ListOfAgendaQuestions.vue +4 -3
  16. package/src/pages/Cooperative/ListOfMeets/ui/ListOfMeetsPage.vue +4 -4
  17. package/src/pages/PermissionDenied/PermissionDenied.vue +1 -3
  18. package/src/pages/Registrator/SignIn/ui/SignInPage.vue +4 -3
  19. package/src/pages/Registrator/SignUp/SignUp.vue +9 -10
  20. package/src/pages/Registrator/SignUp/WaitingRegistration.vue +4 -4
  21. package/src/pages/Union/ConnectionAgreement/ConnectionAgreementPage.vue +25 -23
  22. package/src/pages/User/PaymentMethodsPage/ui/PaymentMethods.vue +3 -3
  23. package/src/pages/User/ProfilePage/ui/ProfilePage.vue +10 -10
  24. package/src/pages/User/WalletPage/ui/WalletPage.vue +0 -2
  25. package/src/processes/navigation-guard-setup/index.ts +3 -5
  26. package/src/widgets/Desktop/CmdkTrigger/CmdkTrigger.vue +9 -2
  27. package/src/widgets/Desktop/SecondLevelMenuList/SecondLevelMenuList.vue +8 -8
  28. package/src/widgets/Desktop/WorkspaceMenu/WorkspaceMenu.vue +3 -3
  29. package/src/widgets/Header/CommonHeader/MainHeader.vue +2 -3
  30. package/src/widgets/Header/SettingsDropdown/SettingsDropdown.vue +1 -3
  31. package/src/widgets/NotificationCenter/NotificationCenter.vue +5 -5
  32. package/src/widgets/Questions/ui/QuestionCard/QuestionCard.vue +3 -3
  33. package/src/widgets/User/CoopCard/ui/CoopCard.vue +12 -12
  34. package/src/widgets/Wallet/MicroWallet/ui/MicroWallet.vue +7 -7
  35. package/src/widgets/Wallet/WalletWidget/ui/WalletWidget.vue +5 -5
  36. package/src/entities/Session/composables/useCurrentUser.ts +0 -39
@@ -33,7 +33,7 @@ q-btn(
33
33
  import { ref, watch } from 'vue';
34
34
  import { useCreateCommit } from '../model';
35
35
  import { useSystemStore } from 'src/entities/System/model';
36
- import { useCurrentUser } from 'src/entities/Session/composables/useCurrentUser';
36
+ import { useSessionStore } from 'src/entities/Session';
37
37
  import { generateUniqueHash } from 'src/shared/lib/utils/generateUniqueHash';
38
38
  import { FailAlert, SuccessAlert } from 'src/shared/api/alerts';
39
39
  import { ModalBase } from 'src/shared/ui/ModalBase';
@@ -49,8 +49,8 @@ const props = defineProps<{
49
49
  }>();
50
50
 
51
51
  const system = useSystemStore();
52
- const { username } = useCurrentUser();
53
- const { createCommit, createCommitInput } = useCreateCommit(props.projectHash, username);
52
+ const session = useSessionStore();
53
+ const { createCommit, createCommitInput } = useCreateCommit(props.projectHash, session.username);
54
54
 
55
55
  const loading = ref(false);
56
56
  const showDialog = ref(false);
@@ -88,7 +88,7 @@ const handleCreateCommit = async () => {
88
88
  coopname: system.info.coopname,
89
89
  commit_hours: formData.value.creator_hours,
90
90
  project_hash: props.projectHash || createCommitInput.value.project_hash,
91
- username: username || createCommitInput.value.username,
91
+ username: session.username || createCommitInput.value.username,
92
92
  description: formData.value.description,
93
93
  meta: JSON.stringify({}),
94
94
  };
@@ -38,7 +38,7 @@ div
38
38
  )
39
39
 
40
40
  // Floating Action Button для создания проекта
41
- Fab(v-if='currentUser.isChairman || currentUser.isMember')
41
+ Fab(v-if='session.isChairman || session.isMember')
42
42
  template(#actions)
43
43
  CreateProjectFabAction
44
44
  </template>
@@ -53,11 +53,11 @@ import { Fab } from 'src/shared/ui';
53
53
  import { CreateProjectFabAction } from 'app/extensions/capital/features/Project/CreateProject';
54
54
  import { ProjectsListWidget, ComponentsListWidget, IssuesListWidget, ListFilterWidget } from 'app/extensions/capital/widgets';
55
55
  import { useProjectFilters } from 'app/extensions/capital/widgets/ListFilterWidget/useProjectFilters';
56
- import { useCurrentUser } from 'src/entities/Session';
56
+ import { useSessionStore } from 'src/entities/Session';
57
57
  import { useProjectStore } from 'app/extensions/capital/entities/Project/model';
58
58
 
59
59
  const router = useRouter();
60
- const currentUser = useCurrentUser();
60
+ const session = useSessionStore();
61
61
  const projectStore = useProjectStore();
62
62
 
63
63
  // Используем композабл для управления фильтрами
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coopenomics/desktop",
3
- "version": "2025.11.17-alpha-3",
3
+ "version": "2025.11.18-alpha-1",
4
4
  "description": "A Desktop Project",
5
5
  "productName": "Desktop App",
6
6
  "author": "Alex Ant <dacom.dark.sun@gmail.com>",
@@ -25,9 +25,9 @@
25
25
  "start": "node -r ./alias-resolver.js dist/ssr/index.js"
26
26
  },
27
27
  "dependencies": {
28
- "@coopenomics/controller": "2025.11.17-alpha-3",
29
- "@coopenomics/notifications": "2025.11.17-alpha-3",
30
- "@coopenomics/sdk": "2025.11.17-alpha-3",
28
+ "@coopenomics/controller": "2025.11.18-alpha-1",
29
+ "@coopenomics/notifications": "2025.11.18-alpha-1",
30
+ "@coopenomics/sdk": "2025.11.18-alpha-1",
31
31
  "@dicebear/collection": "^9.0.1",
32
32
  "@dicebear/core": "^9.0.1",
33
33
  "@editorjs/code": "^2.9.3",
@@ -59,7 +59,7 @@
59
59
  "@wharfkit/wallet-plugin-privatekey": "^1.1.0",
60
60
  "axios": "^1.2.1",
61
61
  "compression": "^1.7.4",
62
- "cooptypes": "2025.11.17-alpha-3",
62
+ "cooptypes": "2025.11.18-alpha-1",
63
63
  "dompurify": "^3.1.7",
64
64
  "dotenv": "^16.4.5",
65
65
  "email-regex": "^5.0.0",
@@ -123,5 +123,5 @@
123
123
  "npm": ">= 6.13.4",
124
124
  "yarn": ">= 1.21.1"
125
125
  },
126
- "gitHead": "27c7ae9d76d98fc37b5ec7454bf79c4ffc731a9f"
126
+ "gitHead": "86172790d1a19def4062384a0aa1f67f40ca51cf"
127
127
  }
@@ -4,7 +4,6 @@ import { useRoute } from 'vue-router';
4
4
  import { useWindowSize } from 'vue-window-size';
5
5
  import { useSystemStore } from 'src/entities/System/model';
6
6
  import { useSessionStore } from 'src/entities/Session';
7
- import { useCurrentUser } from 'src/entities/Session';
8
7
  import { useDesktopStore } from 'src/entities/Desktop/model';
9
8
 
10
9
  export function useDefaultLayoutLogic() {
@@ -12,7 +11,6 @@ export function useDefaultLayoutLogic() {
12
11
  const { width } = useWindowSize();
13
12
  const route = useRoute();
14
13
  const session = useSessionStore();
15
- const currentUser = useCurrentUser();
16
14
  const system = useSystemStore();
17
15
  const desktop = useDesktopStore();
18
16
 
@@ -32,7 +30,7 @@ export function useDefaultLayoutLogic() {
32
30
  );
33
31
 
34
32
  const isRegistrationComplete = computed(
35
- () => currentUser.isRegistrationComplete.value,
33
+ () => session.isRegistrationComplete,
36
34
  );
37
35
 
38
36
  const loggedIn = computed(
@@ -1,7 +1,7 @@
1
1
  import { defineStore } from 'pinia';
2
2
  import { computed, ref, nextTick } from 'vue';
3
3
  import { useRouter } from 'vue-router';
4
- import { useCurrentUser } from 'src/entities/Session';
4
+ import { useSessionStore } from 'src/entities/Session';
5
5
  import { useDesktopStore } from 'src/entities/Desktop/model';
6
6
  import { useSystemStore } from 'src/entities/System/model';
7
7
  import type { PageItem, GroupedItem } from './types';
@@ -11,7 +11,7 @@ const namespace = 'cmdk-menu';
11
11
  export const useCmdkMenuStore = defineStore(namespace, () => {
12
12
  // Composables
13
13
  const router = useRouter();
14
- const user = useCurrentUser();
14
+ const session = useSessionStore();
15
15
  const desktop = useDesktopStore();
16
16
  const { info } = useSystemStore();
17
17
 
@@ -71,18 +71,20 @@ export const useCmdkMenuStore = defineStore(namespace, () => {
71
71
 
72
72
  // Вычисляем роль пользователя
73
73
  const userRole = computed(() =>
74
- user.isChairman ? 'chairman' : user.isMember ? 'member' : 'user'
74
+ session.isChairman ? 'chairman' : session.isMember ? 'member' : 'user'
75
75
  );
76
76
 
77
77
  // Группировка воркспейсов с их страницами
78
78
  const groupedItems = computed<GroupedItem[]>(() => {
79
79
 
80
- return desktop.workspaceMenus
80
+ const result = desktop.workspaceMenus
81
81
  .filter(
82
- (item) =>
83
- item.meta?.roles?.includes(userRole.value) ||
84
- item.meta?.roles === undefined ||
85
- item.meta?.roles.length === 0
82
+ (item) => {
83
+ const hasRole = item.meta?.roles?.includes(userRole.value);
84
+ const noRoles = item.meta?.roles === undefined || item.meta?.roles.length === 0;
85
+ const passes = hasRole || noRoles;
86
+ return passes;
87
+ }
86
88
  )
87
89
  .map(workspace => ({
88
90
  workspaceName: workspace.workspaceName,
@@ -98,10 +100,10 @@ const groupedItems = computed<GroupedItem[]>(() => {
98
100
  page.meta.roles.length === 0;
99
101
  const conditionMatch = page.meta?.conditions
100
102
  ? evaluateCondition(page.meta.conditions, {
101
- isCoop: user.privateAccount.value?.type === 'organization' &&
102
- user.privateAccount.value?.organization_data?.type?.toUpperCase() === 'COOP',
103
+ isCoop: session.privateAccount?.type === 'organization' &&
104
+ session.privateAccount?.organization_data?.type?.toUpperCase() === 'COOP',
103
105
  userRole: userRole.value,
104
- userAccount: user.privateAccount.value,
106
+ userAccount: session.privateAccount,
105
107
  coopname: info.coopname,
106
108
  })
107
109
  : true;
@@ -114,7 +116,9 @@ const groupedItems = computed<GroupedItem[]>(() => {
114
116
  meta: page.meta,
115
117
  shortcut: getShortcut(page.name),
116
118
  }))
117
- }));
119
+ } ));
120
+
121
+ return result;
118
122
  });
119
123
 
120
124
  // Поиск и фильтрация
@@ -7,7 +7,7 @@ import type {
7
7
  } from './types';
8
8
  import { api } from '../api';
9
9
  import { useSystemStore } from 'src/entities/System/model';
10
- import { useCurrentUser } from 'src/entities/Session';
10
+ import { useSessionStore } from 'src/entities/Session';
11
11
 
12
12
  interface WorkspaceMenuItem {
13
13
  workspaceName: string;
@@ -85,6 +85,7 @@ export const useDesktopStore = defineStore(namespace, () => {
85
85
 
86
86
  const workspaceMenus = computed<WorkspaceMenuItem[]>(() => {
87
87
  if (!currentDesktop.value) return [];
88
+
88
89
  return currentDesktop.value.workspaces.map((ws) => {
89
90
  const routes: RouteRecordRaw[] = (ws as any).routes || [];
90
91
  const meta: RouteMeta =
@@ -117,30 +118,33 @@ export const useDesktopStore = defineStore(namespace, () => {
117
118
  }
118
119
 
119
120
  // Функция для определения и выбора дефолтного рабочего стола
120
- function selectDefaultWorkspace() {
121
+ function selectDefaultWorkspace(ignoreSaved = false) {
121
122
  // Сбрасываем состояние загрузки на случай если оно было установлено
122
123
  isWorkspaceChanging.value = false;
123
124
 
124
125
  // Проверяем, был ли ранее сохранен рабочий стол (SSR-safe)
125
- const savedWorkspace = safeLocalStorageGetItem(STORAGE_KEY_WORKSPACE);
126
+ // Но игнорируем сохраненный выбор если передан флаг ignoreSaved (например, после логина)
127
+ if (!ignoreSaved) {
128
+ const savedWorkspace = safeLocalStorageGetItem(STORAGE_KEY_WORKSPACE);
126
129
 
127
- if (
128
- savedWorkspace &&
129
- currentDesktop.value?.workspaces.some((ws) => ws.name === savedWorkspace)
130
- ) {
131
- // Устанавливаем сохраненный рабочий стол без включения состояния загрузки (это инициализация)
132
- activeWorkspaceName.value = savedWorkspace;
133
- return;
130
+ if (
131
+ savedWorkspace &&
132
+ currentDesktop.value?.workspaces.some((ws) => ws.name === savedWorkspace)
133
+ ) {
134
+ // Устанавливаем сохраненный рабочий стол без включения состояния загрузки (это инициализация)
135
+ activeWorkspaceName.value = savedWorkspace;
136
+ return;
137
+ }
134
138
  }
135
139
 
136
140
  // Получаем настройки системы
137
141
  const systemStore = useSystemStore();
138
- const currentUser = useCurrentUser();
142
+ const session = useSessionStore();
139
143
 
140
144
  let defaultWorkspace = 'participant'; // дефолтное значение
141
145
 
142
146
  // Определяем, какие настройки использовать (авторизованный или неавторизованный пользователь)
143
- if (currentUser.isAuth) {
147
+ if (session.isAuth) {
144
148
  // Для авторизованных пользователей используем authorized_default_workspace
145
149
  defaultWorkspace = systemStore.info?.settings?.authorized_default_workspace || 'participant';
146
150
  } else {
@@ -156,8 +160,8 @@ export const useDesktopStore = defineStore(namespace, () => {
156
160
  safeLocalStorageSetItem(STORAGE_KEY_WORKSPACE, defaultWorkspace);
157
161
  } else {
158
162
  // Если настроенный рабочий стол недоступен, используем participant
159
- activeWorkspaceName.value = 'participant';
160
- safeLocalStorageSetItem(STORAGE_KEY_WORKSPACE, 'participant');
163
+ activeWorkspaceName.value = 'participant';
164
+ safeLocalStorageSetItem(STORAGE_KEY_WORKSPACE, 'participant');
161
165
  }
162
166
  }
163
167
 
@@ -238,7 +242,7 @@ export const useDesktopStore = defineStore(namespace, () => {
238
242
  params: Record<string, any>;
239
243
  } | null {
240
244
  const { info } = useSystemStore();
241
- const currentUser = useCurrentUser();
245
+ const session = useSessionStore();
242
246
 
243
247
  if (!currentDesktop.value || !activeWorkspaceName.value) {
244
248
  return null;
@@ -256,7 +260,7 @@ export const useDesktopStore = defineStore(namespace, () => {
256
260
  // Проверяем, есть ли настроенный маршрут для текущего рабочего стола
257
261
  let configuredRoute: string | undefined;
258
262
 
259
- if (currentUser.isAuth) {
263
+ if (session.isAuth) {
260
264
  // Для авторизованных пользователей используем authorized_default_route
261
265
  configuredRoute = info?.settings?.authorized_default_route;
262
266
  } else {
@@ -1,3 +1,2 @@
1
1
  export * from './api';
2
2
  export * from './model/store';
3
- export * from './composables/useCurrentUser';
@@ -19,10 +19,17 @@ interface ISessionStore {
19
19
  // Добавляю данные текущего пользователя
20
20
  currentUserAccount: Ref<IAccount | undefined>;
21
21
  setCurrentUserAccount: (account: IAccount | undefined) => void;
22
+ clearAccount: () => void;
22
23
  // Computed свойства для текущего пользователя
23
24
  isRegistrationComplete: ComputedRef<boolean>;
24
25
  isChairman: ComputedRef<boolean>;
25
26
  isMember: ComputedRef<boolean>;
27
+ // Удобные геттеры для различных типов данных
28
+ userAccount: ComputedRef<IAccount['user_account'] | undefined>;
29
+ privateAccount: ComputedRef<IAccount['private_account'] | undefined>;
30
+ blockchainAccount: ComputedRef<IAccount['blockchain_account'] | undefined>;
31
+ participantAccount: ComputedRef<IAccount['participant_account'] | undefined>;
32
+ providerAccount: ComputedRef<IAccount['provider_account'] | undefined>;
26
33
  }
27
34
 
28
35
  export const useSessionStore = defineStore('session', (): ISessionStore => {
@@ -37,6 +44,10 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
37
44
  currentUserAccount.value = account;
38
45
  };
39
46
 
47
+ const clearAccount = () => {
48
+ setCurrentUserAccount(undefined);
49
+ };
50
+
40
51
  const close = async (): Promise<void> => {
41
52
  isAuth.value = false;
42
53
  session.value = undefined;
@@ -87,6 +98,19 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
87
98
  () => currentUserAccount.value?.provider_account?.role === 'member',
88
99
  );
89
100
 
101
+ // Удобные геттеры для различных типов данных
102
+ const userAccount = computed(() => currentUserAccount.value?.user_account);
103
+ const privateAccount = computed(() => currentUserAccount.value?.private_account);
104
+ const blockchainAccount = computed(
105
+ () => currentUserAccount.value?.blockchain_account,
106
+ );
107
+ const participantAccount = computed(
108
+ () => currentUserAccount.value?.participant_account,
109
+ );
110
+ const providerAccount = computed(
111
+ () => currentUserAccount.value?.provider_account,
112
+ );
113
+
90
114
  const username = computed(() => globalStore.username);
91
115
 
92
116
  return {
@@ -98,8 +122,15 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
98
122
  loadComplete,
99
123
  currentUserAccount,
100
124
  setCurrentUserAccount,
125
+ clearAccount,
101
126
  isRegistrationComplete,
102
127
  isChairman,
103
128
  isMember,
129
+ // Удобные геттеры для различных типов данных
130
+ userAccount,
131
+ privateAccount,
132
+ blockchainAccount,
133
+ participantAccount,
134
+ providerAccount,
104
135
  };
105
136
  });
@@ -2,6 +2,3 @@ export * from './ui';
2
2
  export * from './api';
3
3
  export * from './model';
4
4
 
5
- // Старая система User удалена
6
- // Используйте useCurrentUser из entities/Session
7
- export { useCurrentUser as useCurrentUserStore } from 'src/entities/Session';
@@ -9,7 +9,6 @@ import { useGlobalStore } from 'src/shared/store';
9
9
  import { useSystemStore } from 'src/entities/System/model';
10
10
 
11
11
  import type { IInitialPaymentOrder } from 'src/shared/lib/types/payments';
12
- import { useCurrentUser } from 'src/entities/Session';
13
12
  import { useRegistratorStore } from 'src/entities/Registrator';
14
13
  import {
15
14
  IEntrepreneurData,
@@ -233,14 +232,13 @@ export function useCreateUser() {
233
232
 
234
233
  await sessionStore.init();
235
234
 
236
- const currentUser = useCurrentUser();
237
235
  const accountStore = useAccountStore();
238
236
  // После создания пользователя обновляем данные в сессии
239
237
  const updatedAccount = await accountStore.getAccount(account.username);
240
238
  if (updatedAccount) {
241
239
  console.log('updatedAccount: ', updatedAccount);
242
240
 
243
- currentUser.setCurrentUserAccount(updatedAccount);
241
+ sessionStore.setCurrentUserAccount(updatedAccount);
244
242
  }
245
243
  }
246
244
 
@@ -2,7 +2,6 @@ import { useSessionStore } from 'src/entities/Session';
2
2
  import { useGlobalStore } from 'src/shared/store';
3
3
  import { api } from '../api';
4
4
  import { client } from 'src/shared/api/client';
5
- import { useCurrentUser } from 'src/entities/Session';
6
5
  import { useRegistratorStore } from 'src/entities/Registrator';
7
6
  import type { ITokens } from 'src/shared/lib/types/user';
8
7
  import { useInitWalletProcess } from 'src/processes/init-wallet';
@@ -10,7 +9,7 @@ import type { Zeus } from '@coopenomics/sdk';
10
9
 
11
10
  export function useLoginUser() {
12
11
  const globalStore = useGlobalStore();
13
- const currentUser = useCurrentUser();
12
+ const session = useSessionStore();
14
13
 
15
14
  async function login(email: string, wif: string): Promise<void> {
16
15
  const auth = await api.loginUser(email, wif);
@@ -30,17 +29,15 @@ export function useLoginUser() {
30
29
  await globalStore.setWif(account.username, wif);
31
30
  await globalStore.setTokens(adaptedTokens);
32
31
 
33
- const session = useSessionStore();
34
32
  await session.init();
35
33
  client.setToken(auth.tokens.access.token);
36
34
 
37
35
  const { run } = useInitWalletProcess();
38
36
  await run(); //запускаем фоновое обновление кошелька - заменить на подписку потом
39
- if (!currentUser.isRegistrationComplete.value) {
37
+ if (!session.isRegistrationComplete) {
40
38
  const { state, steps } = useRegistratorStore();
41
- state.userData.type = currentUser.privateAccount.value
42
- ?.type as Zeus.AccountType;
43
- const privateData = currentUser.privateAccount.value;
39
+ state.userData.type = session?.privateAccount?.type as Zeus.AccountType;
40
+ const privateData = session?.privateAccount;
44
41
 
45
42
  // Для каждого типа пользователя берём нужное поле и, если оно существует, переносим совпадающие ключи
46
43
  const dataMap = {
@@ -59,15 +56,15 @@ export function useLoginUser() {
59
56
  }
60
57
 
61
58
  //continue registration process here
62
- state.account.username = currentUser.username as string;
59
+ state.account.username = session.username as string;
63
60
  state.account.private_key = wif;
64
- state.account.public_key = currentUser.providerAccount.value
61
+ state.account.public_key = session.providerAccount
65
62
  ?.public_key as string;
66
63
 
67
- state.email = currentUser.providerAccount.value?.email as string;
64
+ state.email = session.providerAccount?.email as string;
68
65
 
69
66
  // Статус берем из userAccount, не providerAccount
70
- const userStatus = currentUser.userAccount.value?.status;
67
+ const userStatus = session.userAccount?.status;
71
68
  if (userStatus === 'created') state.step = steps.ReadStatement;
72
69
  else if (userStatus === 'joined') state.step = steps.PayInitial;
73
70
  else if (userStatus === 'payed') state.step = steps.WaitingRegistration;
@@ -34,7 +34,6 @@ form.full-width(@submit.prevent='submit')
34
34
  )
35
35
  </template>
36
36
  <script lang="ts" setup>
37
- import { useCurrentUser } from 'src/entities/Session';
38
37
  import { useSessionStore } from 'src/entities/Session';
39
38
  import { useLoginUser } from 'src/features/User/LoginUser';
40
39
  import { useNotificationPermissionDialog } from 'src/features/NotificationPermissionDialog';
@@ -49,7 +48,7 @@ const router = useRouter();
49
48
  const email = ref('');
50
49
  const privateKey = ref('');
51
50
  const loading = ref(false);
52
- const currentUser = useCurrentUser();
51
+ const session = useSessionStore();
53
52
 
54
53
  // Диалог разрешения уведомлений
55
54
  const { showDialog } = useNotificationPermissionDialog();
@@ -104,20 +103,30 @@ const submit = async () => {
104
103
  const { login } = useLoginUser();
105
104
  await login(email.value, privateKey.value);
106
105
 
107
- if (!currentUser.isRegistrationComplete.value) {
106
+ if (!session.isRegistrationComplete) {
108
107
  // Если регистрация не завершена, выключаем лоадер и идем на signup
109
108
  desktops.setWorkspaceChanging(false);
110
109
  router.push({ name: 'signup' });
111
110
  } else {
111
+ // Дожидаемся завершения загрузки данных пользователя (включая роль)
112
+ let attempts = 0;
113
+ const maxAttempts = 50; // 5 секунд максимум
114
+
115
+ while (!session.loadComplete && attempts < maxAttempts) {
116
+ await new Promise((resolve) => setTimeout(resolve, 100));
117
+ attempts++;
118
+ }
119
+
112
120
  // Пробуем перейти по сохраненному URL
113
121
  if (!navigateToSavedUrl()) {
114
122
  // Если сохраненного URL нет, переходим на страницу по умолчанию
115
- desktops.selectDefaultWorkspace();
123
+ // Теперь selectDefaultWorkspace будет работать с актуальными данными о роли
124
+ // Передаем ignoreSaved=true чтобы пересчитать рабочий стол на основе новой роли
125
+ desktops.selectDefaultWorkspace(true);
116
126
  desktops.goToDefaultPage(router);
117
127
  }
118
128
 
119
129
  // Проверяем, если данные уже загружены, выключаем лоадер
120
- const session = useSessionStore();
121
130
  if (session.loadComplete) {
122
131
  desktops.setWorkspaceChanging(false);
123
132
  }
@@ -1,7 +1,6 @@
1
1
  import { useSessionStore } from 'src/entities/Session';
2
2
  import { useGlobalStore } from 'src/shared/store';
3
3
  // import { api } from '../api'
4
- import { useCurrentUser } from 'src/entities/Session';
5
4
  import { useRegistratorStore } from 'src/entities/Registrator';
6
5
 
7
6
  export function useLogoutUser() {
@@ -12,8 +11,9 @@ export function useLogoutUser() {
12
11
 
13
12
  await global.logout();
14
13
 
15
- useSessionStore().close();
16
- useCurrentUser().clearAccount();
14
+ const session = useSessionStore();
15
+ session.close();
16
+ session.clearAccount();
17
17
  }
18
18
 
19
19
  return {
@@ -11,15 +11,13 @@ import { computed } from 'vue';
11
11
  import { useRouter } from 'vue-router';
12
12
  import { useLogoutUser } from '../../model';
13
13
  import { FailAlert } from 'src/shared/api';
14
- import { useCurrentUser } from 'src/entities/Session';
15
14
  import { useSessionStore } from 'src/entities/Session';
16
15
 
17
16
  const router = useRouter();
18
17
  const session = useSessionStore();
19
- const currentUser = useCurrentUser();
20
18
 
21
19
  const loggedIn = computed(
22
- () => currentUser.isRegistrationComplete.value && session.isAuth,
20
+ () => session.isRegistrationComplete && session.isAuth,
23
21
  );
24
22
 
25
23
  const logout = async () => {
@@ -3,7 +3,7 @@ q-card(flat)
3
3
  QuestionsTable(
4
4
  :decisions='decisions',
5
5
  :loading='loading',
6
- :isChairman='currentUser.isChairman',
6
+ :isChairman='session.isChairman',
7
7
  :format-decision-title='formatDecisionTitle',
8
8
  :is-voted-for='isVotedFor',
9
9
  :is-voted-against='isVotedAgainst',
@@ -18,7 +18,7 @@ q-card(flat)
18
18
  <script setup lang="ts">
19
19
  import { onBeforeUnmount, computed, ref, onMounted } from 'vue';
20
20
  import { useRoute } from 'vue-router';
21
- import { useCurrentUser } from 'src/entities/Session';
21
+ import { useSessionStore } from 'src/entities/Session';
22
22
  import { CreateProjectButton } from 'src/features/Decision/CreateProject';
23
23
  import { useDecisionProcessor } from 'src/processes/process-decisions';
24
24
  import { FailAlert, SuccessAlert } from 'src/shared/api';
@@ -26,7 +26,8 @@ import { QuestionsTable } from 'src/widgets/Questions';
26
26
  import { useHeaderActions } from 'src/shared/hooks';
27
27
 
28
28
  const route = useRoute();
29
- const currentUser = useCurrentUser();
29
+ const session = useSessionStore();
30
+
30
31
  const processingDecisions = ref<Record<number, boolean>>({});
31
32
 
32
33
  // Инжектим кнопку создания решения в заголовок
@@ -14,7 +14,7 @@ import { useRoute } from 'vue-router';
14
14
  import { MeetCardsList } from 'src/widgets/Meets/MeetCardsList';
15
15
  import { CreateMeetButton } from 'src/features/Meet/CreateMeet';
16
16
  import { useMeetStore } from 'src/entities/Meet';
17
- import { useCurrentUser } from 'src/entities/Session';
17
+ import { useSessionStore } from 'src/entities/Session';
18
18
  import { useHeaderActions } from 'src/shared/hooks';
19
19
  import { FailAlert } from 'src/shared/api';
20
20
 
@@ -22,7 +22,7 @@ const route = useRoute();
22
22
  const coopname = computed(() => route.params.coopname as string);
23
23
  const meetStore = useMeetStore();
24
24
 
25
- const currentUser = useCurrentUser();
25
+ const session = useSessionStore();
26
26
 
27
27
  // Данные напрямую из стора
28
28
  const meets = computed(() => meetStore.meets);
@@ -45,7 +45,7 @@ const loadMeets = async () => {
45
45
 
46
46
  // Проверка разрешений
47
47
  const canCreateMeet = computed(() => {
48
- return currentUser.isMember || currentUser.isChairman;
48
+ return session.isMember || session.isChairman;
49
49
  });
50
50
 
51
51
  // Функция для регистрации кнопки
@@ -55,7 +55,7 @@ const registerCreateMeetButton = () => {
55
55
  id: CREATE_MEET_BUTTON_ID,
56
56
  component: CreateMeetButton,
57
57
  props: {
58
- isChairman: currentUser.isChairman,
58
+ isChairman: session.isChairman,
59
59
  },
60
60
  order: 1,
61
61
  });
@@ -19,16 +19,14 @@
19
19
  import { useRouter } from 'vue-router';
20
20
  import { useDesktopStore } from 'src/entities/Desktop/model';
21
21
  import { useSessionStore } from 'src/entities/Session';
22
- import { useCurrentUser } from 'src/entities/Session';
23
22
 
24
23
  const router = useRouter();
25
24
  const desktops = useDesktopStore();
26
25
  const session = useSessionStore();
27
- const currentUser = useCurrentUser();
28
26
 
29
27
  function goBack() {
30
28
  // Если пользователь авторизован, пытаемся перейти на безопасную страницу
31
- if (session.isAuth && currentUser.isRegistrationComplete.value) {
29
+ if (session.isAuth && session.isRegistrationComplete) {
32
30
  // Пытаемся перейти на participant workspace как самый безопасный вариант
33
31
  const hasParticipantWorkspace = desktops.currentDesktop?.workspaces.some(
34
32
  (ws) => ws.name === 'participant',
@@ -14,7 +14,6 @@
14
14
  </template>
15
15
  <script lang="ts" setup>
16
16
  import { useSessionStore } from 'src/entities/Session';
17
- import { useCurrentUser } from 'src/entities/Session';
18
17
  import { SignIn } from 'src/widgets/Registrator/SignIn';
19
18
  import { computed } from 'vue';
20
19
  import { useRouter } from 'vue-router';
@@ -23,10 +22,12 @@ const store = useRegistratorStore().state;
23
22
 
24
23
  const router = useRouter();
25
24
 
25
+ const session = useSessionStore();
26
+
26
27
  const registeredAndloggedIn = computed(() => {
27
28
  return (
28
- useCurrentUser().isRegistrationComplete &&
29
- useSessionStore().isAuth &&
29
+ session.isRegistrationComplete &&
30
+ session.isAuth &&
30
31
  store.step == 1
31
32
  );
32
33
  });