fix
This commit is contained in:
parent
5a27ada250
commit
887bcccd55
@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import moment from "moment";
|
||||
import {
|
||||
Table,
|
||||
@ -16,35 +16,13 @@ import { useAllPromocodes } from "@root/api/promocode/swr";
|
||||
import { usePromocodeStatistics } from "@root/utils/hooks/usePromocodeStatistics";
|
||||
|
||||
import type { Moment } from "moment";
|
||||
import { Promocode } from "@root/model/promocodes";
|
||||
import { promocodeApi } from "../../../../api/promocode/requests";
|
||||
|
||||
async function getPromocodes() {
|
||||
return await promocodeApi.getPromocodeList({
|
||||
limit: 500,
|
||||
filter: {
|
||||
active: true,
|
||||
},
|
||||
page: 0
|
||||
})
|
||||
}
|
||||
|
||||
export const StatisticsPromocode = () => {
|
||||
const [from, setFrom] = useState<Moment | null>(
|
||||
moment(moment().subtract(4, "weeks"))
|
||||
);
|
||||
const [to, setTo] = useState<Moment | null>(moment());
|
||||
const [promocodes, setPromocodes] = useState<Promocode[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const { items } = await getPromocodes()
|
||||
console.log(items)
|
||||
//@ts-ignore
|
||||
setPromocodes(items)
|
||||
})()
|
||||
}, [])
|
||||
|
||||
const promocodes = useAllPromocodes();
|
||||
const promocodeStatistics = usePromocodeStatistics({ to, from });
|
||||
const theme = useTheme();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user