V3-1289 API keys fetch bug (#1531)

This commit is contained in:
Yehor Butko 2019-03-20 13:31:00 +02:00 committed by GitHub
parent e390605b81
commit 0432f8f14d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 7 deletions

View File

@ -47,7 +47,7 @@
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import { removeToken } from '@/utils/tokenManager'; import { removeToken } from '@/utils/tokenManager';
import ROUTES from '@/utils/constants/routerConstants'; import ROUTES from '@/utils/constants/routerConstants';
import { APP_STATE_ACTIONS, PROJETS_ACTIONS, PM_ACTIONS, USER_ACTIONS } from '@/utils/constants/actionNames'; import { APP_STATE_ACTIONS, PROJETS_ACTIONS, PM_ACTIONS, USER_ACTIONS, API_KEYS_ACTIONS, NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
@Component( @Component(
{ {
@ -68,6 +68,8 @@ import { APP_STATE_ACTIONS, PROJETS_ACTIONS, PM_ACTIONS, USER_ACTIONS } from '@/
this.$store.dispatch(PM_ACTIONS.CLEAR); this.$store.dispatch(PM_ACTIONS.CLEAR);
this.$store.dispatch(PROJETS_ACTIONS.CLEAR); this.$store.dispatch(PROJETS_ACTIONS.CLEAR);
this.$store.dispatch(USER_ACTIONS.CLEAR); this.$store.dispatch(USER_ACTIONS.CLEAR);
this.$store.dispatch(API_KEYS_ACTIONS.CLEAR);
this.$store.dispatch(NOTIFICATION_ACTIONS.CLEAR);
} }
}, },
} }

View File

@ -4,6 +4,7 @@
import { NOTIFICATION_MUTATIONS } from '../mutationConstants'; import { NOTIFICATION_MUTATIONS } from '../mutationConstants';
import { NOTIFICATION_TYPES } from '@/utils/constants/notification'; import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
import { DelayedNotification } from '@/types/DelayedNotification'; import { DelayedNotification } from '@/types/DelayedNotification';
import { NOTIFICATION_ACTIONS } from '@/utils/constants/actionNames';
export const notificationsModule = { export const notificationsModule = {
state: { state: {
@ -36,10 +37,13 @@ export const notificationsModule = {
[NOTIFICATION_MUTATIONS.RESUME](state: any): void { [NOTIFICATION_MUTATIONS.RESUME](state: any): void {
state.notificationQueue[0].start(); state.notificationQueue[0].start();
}, },
[NOTIFICATION_MUTATIONS.CLEAR](state: any): void {
state.notificationQueue = [];
},
}, },
actions: { actions: {
// Commits muttation for adding success notification // Commits muttation for adding success notification
success: function ({commit}: any, message: string): void { [NOTIFICATION_ACTIONS.SUCCESS]: function ({commit}: any, message: string): void {
const notification = new DelayedNotification( const notification = new DelayedNotification(
() => commit(NOTIFICATION_MUTATIONS.DELETE), () => commit(NOTIFICATION_MUTATIONS.DELETE),
NOTIFICATION_TYPES.SUCCESS, NOTIFICATION_TYPES.SUCCESS,
@ -49,7 +53,7 @@ export const notificationsModule = {
commit(NOTIFICATION_MUTATIONS.ADD, notification); commit(NOTIFICATION_MUTATIONS.ADD, notification);
}, },
// Commits muttation for adding info notification // Commits muttation for adding info notification
notify: function ({commit}: any, message: string): void { [NOTIFICATION_ACTIONS.NOTIFY]: function ({commit}: any, message: string): void {
const notification = new DelayedNotification( const notification = new DelayedNotification(
() => commit(NOTIFICATION_MUTATIONS.DELETE), () => commit(NOTIFICATION_MUTATIONS.DELETE),
@ -60,7 +64,7 @@ export const notificationsModule = {
commit(NOTIFICATION_MUTATIONS.ADD, notification); commit(NOTIFICATION_MUTATIONS.ADD, notification);
}, },
// Commits muttation for adding error notification // Commits muttation for adding error notification
error: function ({commit}: any, message: string): void { [NOTIFICATION_ACTIONS.ERROR]: function ({commit}: any, message: string): void {
const notification = new DelayedNotification( const notification = new DelayedNotification(
() => commit(NOTIFICATION_MUTATIONS.DELETE), () => commit(NOTIFICATION_MUTATIONS.DELETE),
NOTIFICATION_TYPES.ERROR, NOTIFICATION_TYPES.ERROR,
@ -69,15 +73,18 @@ export const notificationsModule = {
commit(NOTIFICATION_MUTATIONS.ADD, notification); commit(NOTIFICATION_MUTATIONS.ADD, notification);
}, },
deleteNotification: function ({commit}: any): void { [NOTIFICATION_ACTIONS.DELETE]: function ({commit}: any): void {
commit(NOTIFICATION_MUTATIONS.DELETE); commit(NOTIFICATION_MUTATIONS.DELETE);
}, },
pauseNotification: function ({commit}: any): void { [NOTIFICATION_ACTIONS.PAUSE]: function ({commit}: any): void {
commit(NOTIFICATION_MUTATIONS.PAUSE); commit(NOTIFICATION_MUTATIONS.PAUSE);
}, },
resumeNotification: function ({commit}: any): void { [NOTIFICATION_ACTIONS.RESUME]: function ({commit}: any): void {
commit(NOTIFICATION_MUTATIONS.RESUME); commit(NOTIFICATION_MUTATIONS.RESUME);
}, },
[NOTIFICATION_ACTIONS.CLEAR]: function ({commit}): void {
commit(NOTIFICATION_MUTATIONS.CLEAR);
},
}, },
getters: { getters: {
currentNotification: (state: any) => { currentNotification: (state: any) => {

View File

@ -44,6 +44,7 @@ export const NOTIFICATION_MUTATIONS = {
DELETE: 'DELETE_NOTIFICATION', DELETE: 'DELETE_NOTIFICATION',
PAUSE: 'PAUSE_NOTIFICATION', PAUSE: 'PAUSE_NOTIFICATION',
RESUME: 'RESUME_NOTIFICATION', RESUME: 'RESUME_NOTIFICATION',
CLEAR: 'CLEAR_NOTIFICATIONS',
}; };
export const APP_STATE_MUTATIONS = { export const APP_STATE_MUTATIONS = {

View File

@ -22,6 +22,7 @@ export const NOTIFICATION_ACTIONS = {
DELETE: 'deleteNotification', DELETE: 'deleteNotification',
PAUSE: 'pauseNotification', PAUSE: 'pauseNotification',
RESUME: 'resumeNotification', RESUME: 'resumeNotification',
CLEAR: 'clearNotifications',
}; };
export const PM_ACTIONS = { export const PM_ACTIONS = {