mirror of
https://github.com/docmost/docmost.git
synced 2025-11-20 15:51:08 +10:00
Implement password change endpoint
* move email templates to server
This commit is contained in:
@ -1,12 +1,24 @@
|
||||
import api from "@/lib/api-client";
|
||||
import { ILogin, IRegister, ITokenResponse } from "@/features/auth/types/auth.types";
|
||||
import {
|
||||
IChangePassword,
|
||||
ILogin,
|
||||
IRegister,
|
||||
ITokenResponse,
|
||||
} from "@/features/auth/types/auth.types";
|
||||
|
||||
export async function login(data: ILogin): Promise<ITokenResponse>{
|
||||
export async function login(data: ILogin): Promise<ITokenResponse> {
|
||||
const req = await api.post<ITokenResponse>("/auth/login", data);
|
||||
return req.data as ITokenResponse;
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function register(data: IRegister): Promise<ITokenResponse>{
|
||||
export async function register(data: IRegister): Promise<ITokenResponse> {
|
||||
const req = await api.post<ITokenResponse>("/auth/register", data);
|
||||
return req.data as ITokenResponse;
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function changePassword(
|
||||
data: IChangePassword,
|
||||
): Promise<IChangePassword> {
|
||||
const req = await api.post<IChangePassword>("/auth/change-password", data);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
@ -1,18 +1,23 @@
|
||||
export interface ILogin {
|
||||
email: string,
|
||||
password: string
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface IRegister {
|
||||
email: string,
|
||||
password: string
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface ITokens {
|
||||
accessToken: string,
|
||||
refreshToken: string
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export interface ITokenResponse {
|
||||
tokens: ITokens
|
||||
tokens: ITokens;
|
||||
}
|
||||
|
||||
export interface IChangePassword {
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user