push for fix bug!
This commit is contained in:
@@ -2,16 +2,18 @@ import { installationReportsCol } from "../../utility/reports"
|
||||
import { Table } from "../common/table"
|
||||
import { useState } from "react"
|
||||
import { SortingState } from "@tanstack/react-table"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { getRegisterDeviceList } from "../../services/api/register-device"
|
||||
|
||||
export const InstallationReports = () => {
|
||||
const [sorting, setSorting] = useState<SortingState>([])
|
||||
// const { data, isLoading } = useQuery({
|
||||
// queryKey: ["installation-reports-list"],
|
||||
// queryFn: getReportsList
|
||||
// })
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ["register-device"],
|
||||
queryFn: getRegisterDeviceList
|
||||
})
|
||||
|
||||
// if (isLoading) return <p>LODING .....</p>
|
||||
if (isLoading) return <p>LODING .....</p>
|
||||
return (
|
||||
<Table columns={installationReportsCol} data={[]} sorting={sorting} setSorting={setSorting} />
|
||||
<Table columns={installationReportsCol} data={data?.data} sorting={sorting} setSorting={setSorting} />
|
||||
)
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { AddNewCardDialog } from "./add-new-cart-dialog"
|
||||
import { DeleteCardDialog } from "./delete-card"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { getUserCardsList } from "../../services/api/bank-card"
|
||||
import axios from "axios"
|
||||
|
||||
export const ManagementBankAccounts = () => {
|
||||
const [selectedCard, setSelectedCard] = useState<string | number | null>(null)
|
||||
@@ -21,8 +22,12 @@ export const ManagementBankAccounts = () => {
|
||||
const handleCloseDeleteDialog = () => setShowDeleteDialog(false)
|
||||
|
||||
useEffect(() => {
|
||||
console.log("data =>", data)
|
||||
}, [data])
|
||||
axios.get("https://asan-service.com/api/gps/bank-card", {
|
||||
headers: {
|
||||
Authorization: `Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NGY0NDdlOWI2ZDM4YjJhYjc0NDIzNmQiLCJpYXQiOjE3MjM2MzIwMjIsImV4cCI6MTcyNjIyNDAyMn0.erPQMoiL2DN76CssBxlRukLe73T2o98JEB3m9bTnMY4`
|
||||
}
|
||||
}).then((res) => console.log("res>", res)).catch((err) => console.log(err))
|
||||
}, [])
|
||||
|
||||
if (isLoading) return <p>LOADING...</p>
|
||||
return (
|
||||
|
||||
@@ -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;
|
||||
@@ -142,4 +142,31 @@ export interface SubscriptionReportInterface {
|
||||
amount: string
|
||||
contribution: string,
|
||||
percentage: string
|
||||
}
|
||||
|
||||
export interface DeviceId {
|
||||
tomanPrice: number,
|
||||
dollarProfit: number,
|
||||
profit: number,
|
||||
status: number,
|
||||
_id: string,
|
||||
IMEI: string,
|
||||
model: string,
|
||||
score: number,
|
||||
renewalProfit: number,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
id: string
|
||||
}
|
||||
export interface RegisterDeviceResponse {
|
||||
status: number,
|
||||
_id: string,
|
||||
deviceId: DeviceId
|
||||
registerDate: string,
|
||||
userId: string,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
id: string
|
||||
}
|
||||
Reference in New Issue
Block a user