Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/ui/accessrights/v2/src/store/ |
Upload File : |
import { EventEmitter } from 'main.core.events'; import { Builder, type Store } from 'ui.vue3.vuex'; import type { AccessRightsCollection } from './model/access-rights-model'; import { AccessRightsModel } from './model/access-rights-model'; import { ApplicationModel, type Options } from './model/application-model'; import type { UserGroupsCollection } from './model/user-groups-model'; import { UserGroupsModel } from './model/user-groups-model'; export function createStore( options: Readonly<Options>, userGroups: UserGroupsCollection, accessRights: AccessRightsCollection, appGuid: string | number, ): { store: Store, resetState: () => Promise<void>, userGroupsModel: UserGroupsModel, } { const userGroupsModel = UserGroupsModel.create() .setInitialUserGroups(userGroups) ; const accessRightsModel = AccessRightsModel.create() .setInitialAccessRights(accessRights) ; const { store } = Builder .init() .addModel( ApplicationModel.create() .setOptions(options) .setGuid(appGuid) , ) .addModel(accessRightsModel) .addModel(userGroupsModel) .syncBuild() ; return { store, resetState: () => { userGroupsModel.clearState(); accessRightsModel.clearState(); EventEmitter.emit('BX.UI.AccessRights.V2:onResetState', { guid: appGuid, }); }, userGroupsModel, accessRightsModel, }; }