Implemented API keys fetch on login. (#1406)

Implemented API keys fetch on login and reload.
This commit is contained in:
Bogdan Artemenko 2019-03-05 13:51:59 +02:00 committed by GitHub
parent 3e90b9e3b8
commit 467fe3f700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -35,7 +35,7 @@ import { APP_STATE_ACTIONS, PROJETS_ACTIONS, NOTIFICATION_ACTIONS, PM_ACTIONS, A
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_PROJECTS);
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
const pmResponse = await this.$store.dispatch(PM_ACTIONS.FETCH, {limit: 20, offset: 0});
const pmResponse = await this.$store.dispatch(PM_ACTIONS.FETCH);
const keysResponse = await this.$store.dispatch(API_KEYS_ACTIONS.FETCH);
if (!pmResponse.isSuccess) {

View File

@ -19,7 +19,13 @@ import { Component, Vue } from 'vue-property-decorator';
import DashboardHeader from '@/components/header/Header.vue';
import NavigationArea from '@/components/navigation/NavigationArea.vue';
import { removeToken, setToken } from '@/utils/tokenManager';
import { NOTIFICATION_ACTIONS, PROJETS_ACTIONS, PM_ACTIONS, USER_ACTIONS } from '@/utils/constants/actionNames';
import {
NOTIFICATION_ACTIONS,
PROJETS_ACTIONS,
PM_ACTIONS,
USER_ACTIONS,
API_KEYS_ACTIONS
} from '@/utils/constants/actionNames';
import ROUTES from '@/utils/constants/routerConstants';
import ProjectCreationSuccessPopup from '@/components/project/ProjectCreationSuccessPopup.vue';
@ -62,11 +68,17 @@ import ProjectCreationSuccessPopup from '@/components/project/ProjectCreationSuc
if (!this.$store.getters.selectedProject.id) return;
const projectMembersResponse = await this.$store.dispatch(PM_ACTIONS.FETCH, {limit: 20, offset: 0});
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
if (projectMembersResponse.isSuccess) return;
const projectMembersResponse = await this.$store.dispatch(PM_ACTIONS.FETCH);
if (!projectMembersResponse.isSuccess) {
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
}
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch project members');
const keysResponse = await this.$store.dispatch(API_KEYS_ACTIONS.FETCH);
if (!keysResponse.isSuccess) {
this.$store.dispatch(NOTIFICATION_ACTIONS.ERROR, 'Unable to fetch api keys');
}
},
components: {
ProjectCreationSuccessPopup,