mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
chore: use DailyMarketingReportResponse type
This commit is contained in:
@@ -31,7 +31,10 @@ import { MarketingReportApi } from '@/services/api/report/marketing-report';
|
|||||||
import { MARKETING_TYPE_OPTIONS } from '@/config/constant';
|
import { MARKETING_TYPE_OPTIONS } from '@/config/constant';
|
||||||
import { httpClient } from '@/services/http/client';
|
import { httpClient } from '@/services/http/client';
|
||||||
import { BaseApiResponse } from '@/types/api/api-general';
|
import { BaseApiResponse } from '@/types/api/api-general';
|
||||||
import { DailyMarketingReport } from '@/types/api/report/marketing';
|
import {
|
||||||
|
DailyMarketingReport,
|
||||||
|
DailyMarketingReportResponse,
|
||||||
|
} from '@/types/api/report/marketing';
|
||||||
import { isResponseError } from '@/lib/api-helper';
|
import { isResponseError } from '@/lib/api-helper';
|
||||||
|
|
||||||
const DailyMarketingReportContent = () => {
|
const DailyMarketingReportContent = () => {
|
||||||
@@ -191,9 +194,10 @@ const DailyMarketingReportContent = () => {
|
|||||||
const queryString = `?${params.toString()}`;
|
const queryString = `?${params.toString()}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const dailyMarketingsReport = await httpClient<
|
const dailyMarketingsReport =
|
||||||
BaseApiResponse<DailyMarketingReport>
|
await httpClient<DailyMarketingReportResponse>(
|
||||||
>(`${MarketingReportApi.basePath}${queryString}`);
|
`${MarketingReportApi.basePath}${queryString}`
|
||||||
|
);
|
||||||
|
|
||||||
if (isResponseError(dailyMarketingsReport)) {
|
if (isResponseError(dailyMarketingsReport)) {
|
||||||
toast.error('Gagal melakukan export penjualan harian! Coba lagi.');
|
toast.error('Gagal melakukan export penjualan harian! Coba lagi.');
|
||||||
@@ -202,7 +206,10 @@ const DailyMarketingReportContent = () => {
|
|||||||
|
|
||||||
const openPdf = async () => {
|
const openPdf = async () => {
|
||||||
const dailyMarketingReportPdfBlob = await pdf(
|
const dailyMarketingReportPdfBlob = await pdf(
|
||||||
<DailyMarketingReportPDF data={dailyMarketingsReport.data} />
|
<DailyMarketingReportPDF
|
||||||
|
data={dailyMarketingsReport.data}
|
||||||
|
total={dailyMarketingsReport.total}
|
||||||
|
/>
|
||||||
).toBlob();
|
).toBlob();
|
||||||
|
|
||||||
const dailyMarketingReportPdfUrl = URL.createObjectURL(
|
const dailyMarketingReportPdfUrl = URL.createObjectURL(
|
||||||
@@ -213,7 +220,10 @@ const DailyMarketingReportContent = () => {
|
|||||||
|
|
||||||
const downloadPdf = async () => {
|
const downloadPdf = async () => {
|
||||||
const blob = await pdf(
|
const blob = await pdf(
|
||||||
<DailyMarketingReportPDF data={dailyMarketingsReport.data} />
|
<DailyMarketingReportPDF
|
||||||
|
data={dailyMarketingsReport.data}
|
||||||
|
total={dailyMarketingsReport.total}
|
||||||
|
/>
|
||||||
).toBlob();
|
).toBlob();
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user