feat: use RTK Query to get order deails (#73)
This commit is contained in:
13
src/models/api/common.ts
Normal file
13
src/models/api/common.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
type SuccessResponse<Body> = {
|
||||
success: true;
|
||||
body: Body;
|
||||
};
|
||||
|
||||
export type ErrorMessage = string;
|
||||
|
||||
type ErrorResponse = {
|
||||
success: false;
|
||||
message: ErrorMessage;
|
||||
};
|
||||
|
||||
export type BaseResponse<Body> = SuccessResponse<Body> | ErrorResponse;
|
||||
@@ -1 +1,2 @@
|
||||
export * from './common';
|
||||
export * from './order';
|
||||
@@ -1,6 +1,16 @@
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
import { Order } from "../landing";
|
||||
|
||||
import { ErrorMessage } from "./common";
|
||||
|
||||
export namespace GetOrder {
|
||||
export type Response = Order.View;
|
||||
export type Params = {
|
||||
orderId: Order.Id
|
||||
};
|
||||
export type Error = ErrorMessage;
|
||||
}
|
||||
|
||||
export namespace CreateOrder {
|
||||
export type Response = {
|
||||
id: Order.Id
|
||||
@@ -8,11 +18,4 @@ export namespace CreateOrder {
|
||||
export type Params = {
|
||||
body: Order.Create
|
||||
};
|
||||
};
|
||||
|
||||
export namespace GetOrder {
|
||||
export type Response = Order.View;
|
||||
export type Params = {
|
||||
orderId: Order.Id
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user