2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-27 10:51:33 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2018-11-05 15:26:18 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
import Vuex from 'vuex';
|
|
|
|
|
2019-08-20 13:57:43 +01:00
|
|
|
import { ApiKeysApiGql } from '@/api/apiKeys';
|
2019-08-21 15:07:49 +01:00
|
|
|
import { BucketsApiGql } from '@/api/buckets';
|
2019-08-20 13:57:43 +01:00
|
|
|
import { CreditsApiGql } from '@/api/credits';
|
2019-10-23 18:33:24 +01:00
|
|
|
import { PaymentsHttpApi } from '@/api/payments';
|
2019-08-20 13:57:43 +01:00
|
|
|
import { ProjectMembersApiGql } from '@/api/projectMembers';
|
2019-09-09 11:33:39 +01:00
|
|
|
import { ProjectsApiGql } from '@/api/projects';
|
|
|
|
import { ProjectUsageApiGql } from '@/api/usage';
|
2019-08-20 13:57:43 +01:00
|
|
|
import { UsersApiGql } from '@/api/users';
|
2019-08-15 19:21:46 +01:00
|
|
|
import { makeApiKeysModule } from '@/store/modules/apiKeys';
|
2019-09-09 11:33:39 +01:00
|
|
|
import { appStateModule } from '@/store/modules/appState';
|
2019-08-21 15:07:49 +01:00
|
|
|
import { makeBucketsModule } from '@/store/modules/buckets';
|
2019-09-09 11:33:39 +01:00
|
|
|
import { makeCreditsModule } from '@/store/modules/credits';
|
|
|
|
import { makeNotificationsModule } from '@/store/modules/notifications';
|
2019-10-23 18:33:24 +01:00
|
|
|
import { makePaymentsModule } from '@/store/modules/payments';
|
2019-08-20 13:57:43 +01:00
|
|
|
import { makeProjectMembersModule } from '@/store/modules/projectMembers';
|
|
|
|
import { makeProjectsModule } from '@/store/modules/projects';
|
2019-08-28 10:53:53 +01:00
|
|
|
import { makeUsageModule } from '@/store/modules/usage';
|
2019-08-20 13:57:43 +01:00
|
|
|
import { makeUsersModule } from '@/store/modules/users';
|
2018-11-26 15:57:11 +00:00
|
|
|
|
2018-11-05 15:26:18 +00:00
|
|
|
Vue.use(Vuex);
|
|
|
|
|
2019-08-14 19:11:18 +01:00
|
|
|
export class StoreModule<S> {
|
|
|
|
public state: S;
|
|
|
|
public mutations: any;
|
|
|
|
public actions: any;
|
2019-08-19 19:12:23 +01:00
|
|
|
public getters?: any;
|
2019-08-14 19:11:18 +01:00
|
|
|
}
|
|
|
|
|
2019-08-19 19:12:23 +01:00
|
|
|
// TODO: remove it after we will use modules as classes and use some DI framework
|
2019-08-14 19:11:18 +01:00
|
|
|
const usersApi = new UsersApiGql();
|
2019-08-19 11:00:38 +01:00
|
|
|
const apiKeysApi = new ApiKeysApiGql();
|
2019-08-19 19:12:23 +01:00
|
|
|
const creditsApi = new CreditsApiGql();
|
2019-08-21 15:07:49 +01:00
|
|
|
const bucketsApi = new BucketsApiGql();
|
2019-08-20 13:57:43 +01:00
|
|
|
const projectMembersApi = new ProjectMembersApiGql();
|
2019-08-22 17:03:13 +01:00
|
|
|
const projectsApi = new ProjectsApiGql();
|
2019-08-28 10:53:53 +01:00
|
|
|
const projectUsageApi = new ProjectUsageApiGql();
|
2019-10-23 18:33:24 +01:00
|
|
|
const paymentsApi = new PaymentsHttpApi();
|
2019-08-14 19:11:18 +01:00
|
|
|
|
2018-11-27 13:14:10 +00:00
|
|
|
// Satellite store (vuex)
|
2019-10-28 13:27:12 +00:00
|
|
|
export const store = new Vuex.Store({
|
2019-02-20 13:33:56 +00:00
|
|
|
modules: {
|
2019-08-21 14:21:23 +01:00
|
|
|
notificationsModule: makeNotificationsModule(),
|
2019-08-19 11:00:38 +01:00
|
|
|
apiKeysModule: makeApiKeysModule(apiKeysApi),
|
2019-08-20 13:57:43 +01:00
|
|
|
appStateModule,
|
2019-08-19 19:12:23 +01:00
|
|
|
creditsModule: makeCreditsModule(creditsApi),
|
2019-08-20 13:57:43 +01:00
|
|
|
projectMembersModule: makeProjectMembersModule(projectMembersApi),
|
2019-10-23 18:33:24 +01:00
|
|
|
paymentsModule: makePaymentsModule(paymentsApi),
|
2019-08-21 15:07:49 +01:00
|
|
|
usersModule: makeUsersModule(usersApi),
|
2019-08-22 17:03:13 +01:00
|
|
|
projectsModule: makeProjectsModule(projectsApi),
|
2019-08-28 10:53:53 +01:00
|
|
|
usageModule: makeUsageModule(projectUsageApi),
|
2019-08-21 15:07:49 +01:00
|
|
|
bucketUsageModule: makeBucketsModule(bucketsApi),
|
2019-09-13 15:58:18 +01:00
|
|
|
},
|
2018-11-05 15:26:18 +00:00
|
|
|
});
|