feat: add version check (#922)

* Add version endpoint

* version indicator

* refetch

* * Translate strings
* Handle error
This commit is contained in:
Philip Okugbe
2025-03-22 15:29:10 +00:00
committed by GitHub
parent c824b5b570
commit f8ce160906
11 changed files with 156 additions and 17 deletions

View File

@ -15,6 +15,7 @@ import {
revokeInvitation,
getWorkspace,
getWorkspacePublicData,
getAppVersion,
} from "@/features/workspace/services/workspace-service";
import { IPagination, QueryParams } from "@/lib/types.ts";
import { notifications } from "@mantine/notifications";
@ -22,6 +23,7 @@ import {
ICreateInvite,
IInvitation,
IPublicWorkspace,
IVersion,
IWorkspace,
} from "@/features/workspace/types/workspace.types.ts";
import { IUser } from "@/features/user/types/user.types.ts";
@ -153,3 +155,15 @@ export function useGetInvitationQuery(
enabled: !!invitationId,
});
}
export function useAppVersion(
isEnabled: boolean,
): UseQueryResult<IVersion, Error> {
return useQuery({
queryKey: ["version"],
queryFn: () => getAppVersion(),
staleTime: 60 * 60 * 1000, // 1 hr
enabled: isEnabled,
refetchOnMount: true,
});
}