diff --git a/packages/frontend/editor-ui/src/features/credentials/components/CredentialEdit/CredentialEdit.vue b/packages/frontend/editor-ui/src/features/credentials/components/CredentialEdit/CredentialEdit.vue index fe7a39c5e31..1a1e3858840 100644 --- a/packages/frontend/editor-ui/src/features/credentials/components/CredentialEdit/CredentialEdit.vue +++ b/packages/frontend/editor-ui/src/features/credentials/components/CredentialEdit/CredentialEdit.vue @@ -1183,6 +1183,7 @@ async function deleteCredential() { async function oAuthCredentialAuthorize() { let url; + credentialsStore.pendingOAuthRefresh = true; const credential = await saveCredential(); if (!credential) { return; diff --git a/packages/frontend/editor-ui/src/features/credentials/credentials.store.ts b/packages/frontend/editor-ui/src/features/credentials/credentials.store.ts index cc4cdac050b..61aae0943fc 100644 --- a/packages/frontend/editor-ui/src/features/credentials/credentials.store.ts +++ b/packages/frontend/editor-ui/src/features/credentials/credentials.store.ts @@ -44,6 +44,8 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => { type CredentialTestStatus = 'pending' | 'success' | 'error'; const credentialTestResults = ref(new Map()); + const pendingOAuthRefresh = ref(false); + const isCredentialTestedOk = (id: string): boolean => { return credentialTestResults.value.get(id) === 'success'; }; @@ -520,6 +522,7 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => { getCredentialTranslation, setCredentialSharedWith, claimFreeAiCredits, + pendingOAuthRefresh, }; }); diff --git a/packages/frontend/editor-ui/src/features/credentials/views/CredentialsView.vue b/packages/frontend/editor-ui/src/features/credentials/views/CredentialsView.vue index c8ee8b1e688..c54fc3b009d 100644 --- a/packages/frontend/editor-ui/src/features/credentials/views/CredentialsView.vue +++ b/packages/frontend/editor-ui/src/features/credentials/views/CredentialsView.vue @@ -145,6 +145,14 @@ listenForModalChanges({ if ([CREDENTIAL_SELECT_MODAL_KEY, CREDENTIAL_EDIT_MODAL_KEY].includes(modalName as string)) { void router.replace({ params: { credentialId: '' }, query: route.query }); } + if (modalName === CREDENTIAL_EDIT_MODAL_KEY && credentialsStore.pendingOAuthRefresh) { + credentialsStore.pendingOAuthRefresh = false; + void credentialsStore.fetchAllCredentials({ + projectId: route?.params?.projectId as string | undefined, + includeScopes: true, + externalSecretsStore: filters.value.externalSecretsStore, + }); + } }, });