Compare commits
No commits in common. "aa322d0c8f1b04b7fc34f1d5960da4d71ae385a5" and "e7f6de4a299b1941dff872ab242f9a8bde042e48" have entirely different histories.
aa322d0c8f
...
e7f6de4a29
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type {IAllReferralCodeRes, IApiAllTradesRes, IApiUserAssetsRes} from "@/interfaces/api.interface";
|
import type { IApiAllTradesRes, IApiUserAssetsRes } from "@/interfaces/api.interface";
|
||||||
import { IUserWalletCryptos } from "@/interfaces/crypto.interface";
|
import { IUserWalletCryptos } from "@/interfaces/crypto.interface";
|
||||||
import { EReturnState, type IStandardisedReturn } from "@/interfaces/general.interface";
|
import { EReturnState, type IStandardisedReturn } from "@/interfaces/general.interface";
|
||||||
import type { IUserData, IUserWallet } from "@/interfaces/userdata.interface";
|
import type { IUserData, IUserWallet } from "@/interfaces/userdata.interface";
|
||||||
@ -93,99 +93,15 @@ export async function getAlltrades() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createTrade(data: any) {
|
export async function createTrade() {}
|
||||||
const ReqRes =
|
|
||||||
await ApiRequest.authenticated.post.json<IStandardisedReturn<IApiAllTradesRes>>(
|
|
||||||
"trade/create",
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
export async function getAllTrade() {}
|
||||||
);
|
|
||||||
console.log(ReqRes.data);
|
|
||||||
|
|
||||||
if (ReqRes.status !== 200) {
|
export async function getUserTrade() {}
|
||||||
return {
|
|
||||||
state: EReturnState.clientError,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
state: EReturnState.done,
|
|
||||||
resolved: ReqRes.data,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAllTrade() {
|
export async function getAllReferralCode() {}
|
||||||
const ReqRes =
|
|
||||||
await ApiRequest.authenticated.get.json<IStandardisedReturn<IApiAllTradesRes>>(
|
|
||||||
"trade/all",
|
|
||||||
);
|
|
||||||
console.log(ReqRes.data);
|
|
||||||
|
|
||||||
if (ReqRes.status !== 200) {
|
export async function createReferralCode() {}
|
||||||
return {
|
|
||||||
state: EReturnState.clientError,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
state: EReturnState.done,
|
|
||||||
resolved: ReqRes.data,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getUserTrade() {
|
|
||||||
const ReqRes =
|
|
||||||
await ApiRequest.authenticated.get.json<IStandardisedReturn<IApiAllTradesRes>>(
|
|
||||||
"user/my-trades",
|
|
||||||
);
|
|
||||||
console.log(ReqRes.data);
|
|
||||||
|
|
||||||
if (ReqRes.status !== 200) {
|
|
||||||
return {
|
|
||||||
state: EReturnState.clientError,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
state: EReturnState.done,
|
|
||||||
resolved: ReqRes.data,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAllReferralCode() {
|
|
||||||
const ReqRes =
|
|
||||||
await ApiRequest.authenticated.get.json<IStandardisedReturn<IAllReferralCodeRes>>(
|
|
||||||
"promoCode/all",
|
|
||||||
);
|
|
||||||
console.log(ReqRes.data);
|
|
||||||
|
|
||||||
if (ReqRes.status !== 200) {
|
|
||||||
return {
|
|
||||||
state: EReturnState.clientError,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
state: EReturnState.done,
|
|
||||||
resolved: ReqRes.data,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createReferralCode(data: any) {
|
|
||||||
const ReqRes =
|
|
||||||
await ApiRequest.authenticated.post.json<IStandardisedReturn<IAllReferralCodeRes>>(
|
|
||||||
"promoCode/create",
|
|
||||||
data
|
|
||||||
);
|
|
||||||
console.log(ReqRes.data);
|
|
||||||
|
|
||||||
if (ReqRes.status !== 200) {
|
|
||||||
return {
|
|
||||||
state: EReturnState.clientError,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
state: EReturnState.done,
|
|
||||||
resolved: ReqRes.data,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAllCryptos() {}
|
export async function getAllCryptos() {}
|
||||||
|
|
||||||
|
400
temp.ts
400
temp.ts
@ -1,400 +0,0 @@
|
|||||||
////////apiTypes.ts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface ResponseSuccess {
|
|
||||||
|
|
||||||
data: any
|
|
||||||
|
|
||||||
status: number
|
|
||||||
|
|
||||||
statusText: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface ResponseFailed {
|
|
||||||
|
|
||||||
code: string
|
|
||||||
|
|
||||||
message: string
|
|
||||||
|
|
||||||
name: string
|
|
||||||
|
|
||||||
response: {
|
|
||||||
|
|
||||||
data: {
|
|
||||||
|
|
||||||
error: string
|
|
||||||
|
|
||||||
message: string
|
|
||||||
|
|
||||||
statusCode: number
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
status: number
|
|
||||||
|
|
||||||
statusText: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////cryptoTypes.ts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export enum RoleName {
|
|
||||||
|
|
||||||
user = 'user',
|
|
||||||
|
|
||||||
admin = 'admin',
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type Role = {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
name: RoleName
|
|
||||||
|
|
||||||
created_at?: string
|
|
||||||
|
|
||||||
updated_at?: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type PromoCode = {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
name: string
|
|
||||||
|
|
||||||
value: number
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type CryptoHistory = {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
id_crypto: string
|
|
||||||
|
|
||||||
value: number
|
|
||||||
|
|
||||||
created_at: string
|
|
||||||
|
|
||||||
updated_at: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface Offer {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
User: {
|
|
||||||
|
|
||||||
pseudo: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
amount: number
|
|
||||||
|
|
||||||
created_at: string
|
|
||||||
|
|
||||||
id_user: string
|
|
||||||
|
|
||||||
Crypto: CryptoData
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface UserAssets {
|
|
||||||
|
|
||||||
firstName: string
|
|
||||||
|
|
||||||
lastName: string
|
|
||||||
|
|
||||||
dollarAvailables: number
|
|
||||||
|
|
||||||
pseudo: string
|
|
||||||
|
|
||||||
age: number
|
|
||||||
|
|
||||||
UserHasCrypto: CryptoData[]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface Signin {
|
|
||||||
|
|
||||||
access_token: string
|
|
||||||
|
|
||||||
user: UserExtended
|
|
||||||
|
|
||||||
Role: Role
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface CryptoData {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
name: string
|
|
||||||
|
|
||||||
value: number
|
|
||||||
|
|
||||||
image: string
|
|
||||||
|
|
||||||
quantity: number
|
|
||||||
|
|
||||||
created_at: string
|
|
||||||
|
|
||||||
updated_at: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface MyCryptoData {
|
|
||||||
|
|
||||||
Crypto: CryptoData
|
|
||||||
|
|
||||||
amount: number
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface Trade {
|
|
||||||
|
|
||||||
Giver: User
|
|
||||||
|
|
||||||
Receiver: User
|
|
||||||
|
|
||||||
Crypto: CryptoData
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface User {
|
|
||||||
|
|
||||||
firstName: string
|
|
||||||
|
|
||||||
lastName: string
|
|
||||||
|
|
||||||
pseudo: string
|
|
||||||
|
|
||||||
dollarAvailables: number
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UserHasCrypto {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
id_user: string
|
|
||||||
|
|
||||||
id_crypto: string
|
|
||||||
|
|
||||||
amount: number
|
|
||||||
|
|
||||||
createdAt: string
|
|
||||||
|
|
||||||
updated_at: string
|
|
||||||
|
|
||||||
Crypto: CryptoData
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UserExtended extends User {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
hash: string
|
|
||||||
|
|
||||||
email: string
|
|
||||||
|
|
||||||
roleId: string
|
|
||||||
|
|
||||||
isActive: boolean
|
|
||||||
|
|
||||||
city: string
|
|
||||||
|
|
||||||
age: number
|
|
||||||
|
|
||||||
created_at: string
|
|
||||||
|
|
||||||
updated_at: string
|
|
||||||
|
|
||||||
UserHasCrypto?: UserHasCrypto
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface MyTrade {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
id_giver: string
|
|
||||||
|
|
||||||
id_receiver: string
|
|
||||||
|
|
||||||
id_crypto: string
|
|
||||||
|
|
||||||
amount_traded: number
|
|
||||||
|
|
||||||
created_at: string
|
|
||||||
|
|
||||||
updated_at: string
|
|
||||||
|
|
||||||
Crypto: CryptoData
|
|
||||||
|
|
||||||
Giver: UserExtended
|
|
||||||
|
|
||||||
Receiver: UserExtended
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface AuthData {
|
|
||||||
|
|
||||||
access_token: string
|
|
||||||
|
|
||||||
user: {
|
|
||||||
|
|
||||||
id: string
|
|
||||||
|
|
||||||
firstName: string
|
|
||||||
|
|
||||||
lastName: string
|
|
||||||
|
|
||||||
pseudo: string
|
|
||||||
|
|
||||||
hash: null | any
|
|
||||||
|
|
||||||
email: string
|
|
||||||
|
|
||||||
roleId: string
|
|
||||||
|
|
||||||
isActive: boolean
|
|
||||||
|
|
||||||
city: string
|
|
||||||
|
|
||||||
dollarAvailables: number
|
|
||||||
|
|
||||||
age: number
|
|
||||||
|
|
||||||
created_at: string
|
|
||||||
|
|
||||||
updated_at: string
|
|
||||||
|
|
||||||
UserHasCrypto: UserHasCrypto[]
|
|
||||||
|
|
||||||
Role: Role
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////formTypes.ts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type RegisterInput = {
|
|
||||||
|
|
||||||
firstName: string
|
|
||||||
|
|
||||||
lastName: string
|
|
||||||
|
|
||||||
pseudo: string
|
|
||||||
|
|
||||||
city: string
|
|
||||||
|
|
||||||
email: string
|
|
||||||
|
|
||||||
password: string
|
|
||||||
|
|
||||||
confirmPassword: string
|
|
||||||
|
|
||||||
promoCode: string
|
|
||||||
|
|
||||||
age: number
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type LoginInput = {
|
|
||||||
|
|
||||||
email: string
|
|
||||||
|
|
||||||
password: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type RoleInput = {
|
|
||||||
|
|
||||||
name: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type PromoCodeInput = {
|
|
||||||
|
|
||||||
name: string
|
|
||||||
|
|
||||||
value: number
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TradeInput = {
|
|
||||||
|
|
||||||
id_offer: string
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type OfferInput = {
|
|
||||||
|
|
||||||
id_crypto: string
|
|
||||||
|
|
||||||
amount: number
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user