From a5534ec8c7dcbe2454e92bb84b957bc2a09b9566 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Tue, 31 Oct 2023 15:41:11 +0200 Subject: [PATCH] feat(git-creds): disable load not on BE --- .../account/git-credentials/git-credentials.service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/react/portainer/account/git-credentials/git-credentials.service.ts b/app/react/portainer/account/git-credentials/git-credentials.service.ts index 89086a96b..f49adc57b 100644 --- a/app/react/portainer/account/git-credentials/git-credentials.service.ts +++ b/app/react/portainer/account/git-credentials/git-credentials.service.ts @@ -2,6 +2,9 @@ import { useMutation, useQuery, useQueryClient } from 'react-query'; import axios, { parseAxiosError } from '@/portainer/services/axios'; import { success as notifySuccess } from '@/portainer/services/notifications'; +import { UserId } from '@/portainer/users/types'; + +import { isBE } from '../../feature-flags/feature-flags.service'; import { CreateGitCredentialPayload, @@ -112,9 +115,12 @@ export function useDeleteGitCredentialMutation() { }); } -export function useGitCredentials(userId: number) { +export function useGitCredentials( + userId: UserId, + { enabled }: { enabled?: boolean } = {} +) { return useQuery('gitcredentials', () => getGitCredentials(userId), { - staleTime: 20, + enabled: isBE && enabled, meta: { error: { title: 'Failure',