mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
🐛 Fix credentials list load issue (#2931)
* always fetch credentials * only fetch credentials once
This commit is contained in:
parent
c3f3e98718
commit
3bc06ee5c0
|
@ -764,6 +764,7 @@ export interface ICredentialMap {
|
||||||
export interface ICredentialsState {
|
export interface ICredentialsState {
|
||||||
credentialTypes: ICredentialTypeMap;
|
credentialTypes: ICredentialTypeMap;
|
||||||
credentials: ICredentialMap;
|
credentials: ICredentialMap;
|
||||||
|
fetchedAllCredentials: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITagsState {
|
export interface ITagsState {
|
||||||
|
|
|
@ -35,6 +35,7 @@ const module: Module<ICredentialsState, IRootState> = {
|
||||||
state: {
|
state: {
|
||||||
credentialTypes: {},
|
credentialTypes: {},
|
||||||
credentials: {},
|
credentials: {},
|
||||||
|
fetchedAllCredentials: false,
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setCredentialTypes: (state: ICredentialsState, credentialTypes: ICredentialType[]) => {
|
setCredentialTypes: (state: ICredentialsState, credentialTypes: ICredentialType[]) => {
|
||||||
|
@ -52,6 +53,7 @@ const module: Module<ICredentialsState, IRootState> = {
|
||||||
|
|
||||||
return accu;
|
return accu;
|
||||||
}, {});
|
}, {});
|
||||||
|
state.fetchedAllCredentials = true;
|
||||||
},
|
},
|
||||||
upsertCredential(state: ICredentialsState, credential: ICredentialsResponse) {
|
upsertCredential(state: ICredentialsState, credential: ICredentialsResponse) {
|
||||||
if (credential.id) {
|
if (credential.id) {
|
||||||
|
@ -130,7 +132,7 @@ const module: Module<ICredentialsState, IRootState> = {
|
||||||
context.commit('setCredentialTypes', credentialTypes);
|
context.commit('setCredentialTypes', credentialTypes);
|
||||||
},
|
},
|
||||||
fetchAllCredentials: async (context: ActionContext<ICredentialsState, IRootState>) => {
|
fetchAllCredentials: async (context: ActionContext<ICredentialsState, IRootState>) => {
|
||||||
if (context.getters.allCredentials.length > 0) {
|
if (context.state.fetchedAllCredentials) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const credentials = await getAllCredentials(context.rootGetters.getRestApiContext);
|
const credentials = await getAllCredentials(context.rootGetters.getRestApiContext);
|
||||||
|
|
Loading…
Reference in a new issue