mirror of
https://github.com/docmost/docmost.git
synced 2025-11-20 21:01:09 +10:00
feat: add version check (#922)
* Add version endpoint * version indicator * refetch * * Translate strings * Handle error
This commit is contained in:
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import {
|
||||
IAcceptInvite,
|
||||
IPublicWorkspace,
|
||||
IInvitationLink,
|
||||
IVersion,
|
||||
} from "../types/workspace.types";
|
||||
import { IPagination, QueryParams } from "@/lib/types.ts";
|
||||
import { ISetupWorkspace } from "@/features/auth/types/auth.types.ts";
|
||||
@ -73,7 +74,6 @@ export async function getInviteLink(data: {
|
||||
export async function resendInvitation(data: {
|
||||
invitationId: string;
|
||||
}): Promise<void> {
|
||||
console.log(data);
|
||||
await api.post("/workspace/invites/resend", data);
|
||||
}
|
||||
|
||||
@ -97,6 +97,11 @@ export async function createWorkspace(
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function getAppVersion(): Promise<IVersion> {
|
||||
const req = await api.post("/version");
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function uploadLogo(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append("type", "workspace-logo");
|
||||
|
||||
@ -57,3 +57,9 @@ export interface IPublicWorkspace {
|
||||
authProviders: IAuthProvider[];
|
||||
hasLicenseKey?: boolean;
|
||||
}
|
||||
|
||||
export interface IVersion {
|
||||
currentVersion: string;
|
||||
latestVersion: string;
|
||||
releaseUrl: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user