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:
parent
950cb9137f
commit
e9048ca7eb
36
src/interfaces/api.interface.ts
Normal file
36
src/interfaces/api.interface.ts
Normal 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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user