mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -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 {
|
||||
credentialTypes: ICredentialTypeMap;
|
||||
credentials: ICredentialMap;
|
||||
fetchedAllCredentials: boolean;
|
||||
}
|
||||
|
||||
export interface ITagsState {
|
||||
|
|
|
@ -35,6 +35,7 @@ const module: Module<ICredentialsState, IRootState> = {
|
|||
state: {
|
||||
credentialTypes: {},
|
||||
credentials: {},
|
||||
fetchedAllCredentials: false,
|
||||
},
|
||||
mutations: {
|
||||
setCredentialTypes: (state: ICredentialsState, credentialTypes: ICredentialType[]) => {
|
||||
|
@ -52,6 +53,7 @@ const module: Module<ICredentialsState, IRootState> = {
|
|||
|
||||
return accu;
|
||||
}, {});
|
||||
state.fetchedAllCredentials = true;
|
||||
},
|
||||
upsertCredential(state: ICredentialsState, credential: ICredentialsResponse) {
|
||||
if (credential.id) {
|
||||
|
@ -130,7 +132,7 @@ const module: Module<ICredentialsState, IRootState> = {
|
|||
context.commit('setCredentialTypes', credentialTypes);
|
||||
},
|
||||
fetchAllCredentials: async (context: ActionContext<ICredentialsState, IRootState>) => {
|
||||
if (context.getters.allCredentials.length > 0) {
|
||||
if (context.state.fetchedAllCredentials) {
|
||||
return;
|
||||
}
|
||||
const credentials = await getAllCredentials(context.rootGetters.getRestApiContext);
|
||||
|
|
Loading…
Reference in a new issue