push for fix bug!
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
|
||||
export interface AwardsResponse {
|
||||
_id: string,
|
||||
score: number,
|
||||
title: string,
|
||||
desc: string,
|
||||
expireDate: string,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
id: string
|
||||
}
|
||||
|
||||
export const getAwardsList = () => axiosInstance.get<AwardsResponse[] | AwardsResponse | []>("/gps/award")
|
||||
|
||||
@@ -10,6 +10,6 @@ type DeleteCard = {
|
||||
id: string | number | null
|
||||
}
|
||||
|
||||
export const createNewCardMutation = (payload: CreateNewCard) => axiosInstance.post<any>("/gps/bank-card", payload)
|
||||
export const deleteCardMutation = (payload: DeleteCard) => axiosInstance.delete<any>(`/gps/bank-card/:${payload?.id}`)
|
||||
export const getUserCardsList = () => axiosInstance.get<any>("/gps/bank-card")
|
||||
export const createNewCardMutation = (payload: CreateNewCard) => axiosInstance.post<any>("gps/bank-card", payload)
|
||||
export const deleteCardMutation = (payload: DeleteCard) => axiosInstance.delete<any>(`gps/bank-card/:${payload?.id}`)
|
||||
export const getUserCardsList = () => axiosInstance.get<any>("gps/bank-card")
|
||||
@@ -0,0 +1,17 @@
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
export type OverviewUser = {
|
||||
walletBalance: number,
|
||||
dollarBalance: number,
|
||||
score: number,
|
||||
_id: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface OverviewResponse {
|
||||
installedDevice: number,
|
||||
user: OverviewUser
|
||||
}
|
||||
|
||||
export const getOverviewDetails = () => axiosInstance.get<OverviewResponse[] | OverviewResponse | []>("/gps/overview/main")
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { RegisterDeviceResponse } from "../../types";
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
export const getRegisterDeviceList = () => axiosInstance.get<RegisterDeviceResponse[] | RegisterDeviceResponse | []>("/gps/register-device")
|
||||
@@ -0,0 +1,22 @@
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
export type ScoreDataResponse = {
|
||||
_id: string,
|
||||
deviceId: string,
|
||||
score: number,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
userId: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
|
||||
export interface ScoreResponse {
|
||||
data: ScoreDataResponse[] | []
|
||||
score: number,
|
||||
total: number
|
||||
}
|
||||
|
||||
export const getScoresList = () => axiosInstance.get<ScoreResponse>("/gps/score")
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
export const getTransactionsList = () => axiosInstance.get<any>("/gps/transactions")
|
||||
@@ -5,12 +5,12 @@ const axiosInstance = axios.create({
|
||||
});
|
||||
|
||||
axiosInstance.interceptors.request.use(async function (config) {
|
||||
const search = window.location.search;
|
||||
const params = new URLSearchParams(search)
|
||||
const token = localStorage.getItem("token") ? localStorage.getItem("token") : params.get('token')
|
||||
|
||||
// const search = window.location.search;
|
||||
// const params = new URLSearchParams(search)
|
||||
const token = localStorage.getItem("token") && localStorage.getItem("token")
|
||||
config.headers.Authorization = 'Bearer ' + token
|
||||
return config;
|
||||
// config.params = params && params
|
||||
return await config;
|
||||
});
|
||||
|
||||
export default axiosInstance;
|
||||
Reference in New Issue
Block a user