mirror of
https://github.com/docmost/docmost.git
synced 2026-05-15 13:14:11 +08:00
990612793f
* Switch to httpOnly cookie * create endpoint to retrieve temporary collaboration token * cleanups
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import api from "@/lib/api-client";
|
|
import {
|
|
IChangePassword,
|
|
ICollabToken,
|
|
IForgotPassword,
|
|
ILogin,
|
|
IPasswordReset,
|
|
ISetupWorkspace,
|
|
IVerifyUserToken,
|
|
} from "@/features/auth/types/auth.types";
|
|
|
|
export async function login(data: ILogin): Promise<void> {
|
|
await api.post<void>("/auth/login", data);
|
|
}
|
|
|
|
export async function logout(): Promise<void> {
|
|
await api.post<void>("/auth/logout");
|
|
}
|
|
|
|
export async function changePassword(
|
|
data: IChangePassword,
|
|
): Promise<IChangePassword> {
|
|
const req = await api.post<IChangePassword>("/auth/change-password", data);
|
|
return req.data;
|
|
}
|
|
|
|
export async function setupWorkspace(
|
|
data: ISetupWorkspace,
|
|
): Promise<any> {
|
|
const req = await api.post<any>("/auth/setup", data);
|
|
return req.data;
|
|
}
|
|
|
|
export async function forgotPassword(data: IForgotPassword): Promise<void> {
|
|
await api.post<void>("/auth/forgot-password", data);
|
|
}
|
|
|
|
export async function passwordReset(data: IPasswordReset): Promise<void> {
|
|
await api.post<void>("/auth/password-reset", data);
|
|
}
|
|
|
|
export async function verifyUserToken(data: IVerifyUserToken): Promise<any> {
|
|
return api.post<any>("/auth/verify-token", data);
|
|
}
|
|
|
|
export async function getCollabToken(): Promise<ICollabToken> {
|
|
const req = await api.post<ICollabToken>("/auth/collab-token");
|
|
return req.data;
|
|
}
|