Improved polling

This commit is contained in:
Daniel Hougaard
2024-02-22 05:00:26 +01:00
parent 4121c1d573
commit c1c66da92b
3 changed files with 47 additions and 44 deletions
+10 -2
View File
@@ -14,6 +14,7 @@ import {
DeleteWorkspaceDTO,
NameWorkspaceSecretsDTO,
RenameWorkspaceDTO,
TGetUpgradeProjectStatusDTO,
ToggleAutoCapitalizationDTO,
UpdateEnvironmentDTO,
Workspace
@@ -85,11 +86,18 @@ export const useUpgradeProject = () => {
});
};
export const useGetUpgradeProjectStatus = (projectId: string) => {
export const useGetUpgradeProjectStatus = ({
projectId,
onSuccess,
enabled,
refetchInterval
}: TGetUpgradeProjectStatusDTO) => {
return useQuery({
queryKey: workspaceKeys.getProjectUpgradeStatus(projectId),
queryFn: () => fetchProjectUpgradeStatus(projectId),
enabled: true
enabled,
onSuccess,
refetchInterval
});
};
@@ -31,6 +31,13 @@ export type NameWorkspaceSecretsDTO = {
}[];
};
export type TGetUpgradeProjectStatusDTO = {
projectId: string;
onSuccess?: (data?: { status: string }) => void;
enabled?: boolean;
refetchInterval?: number;
};
// mutation dto
export type CreateWorkspaceDTO = {
projectName: string;