feat(interfaces): add API request/response interfaces

Created new typescript interfaces for API. They include IApiRegisterReq, IApiLoginReq, IAbstractApiResponse, IApiRegisterRes, and IApiLoginRes. These interfaces will be used to properly structure the data for API requests and responses, thus enhancing type safety and maintainability.
This commit is contained in:
Mathis H (Avnyr) 2024-06-11 16:08:34 +02:00
parent 950cb9137f
commit e9048ca7eb
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -0,0 +1,36 @@
import {IUserData} from "@/interfaces/userdata.interface";
// ----- Request -----
export interface IApiRegisterReq {
firstName: string;
lastName: string;
pseudo: string;
city: string;
email: string;
password: string;
age: number;
}
export interface IApiLoginReq {
email: string;
password: string;
}
// ----- Response -----
export interface IAbstractApiResponse {
message?: Array<string>;
error?: string;
statusCode?: number
}
export interface IApiRegisterRes extends IAbstractApiResponse {
access_token?: string;
user?: IUserData
}
export interface IApiLoginRes extends IAbstractApiResponse {
access_token?: string
}