fitst commit
This commit is contained in:
19
screens/announcements/lib/api.ts
Normal file
19
screens/announcements/lib/api.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import httpClient from '@/api/httpClient';
|
||||
import { API_URLS } from '@/api/URLs';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { AnnouncementDetailBody, AnnouncementListBody } from './type';
|
||||
|
||||
export const announcement_api = {
|
||||
async list(params: {
|
||||
page: number;
|
||||
page_size: number;
|
||||
}): Promise<AxiosResponse<AnnouncementListBody>> {
|
||||
const res = await httpClient.get(API_URLS.DASHBOARD_ADS, { params });
|
||||
return res;
|
||||
},
|
||||
|
||||
async detail(id: number): Promise<AxiosResponse<AnnouncementDetailBody>> {
|
||||
const res = await httpClient.get(API_URLS.DASHBOARD_ADS_DETAIL(id));
|
||||
return res;
|
||||
},
|
||||
};
|
||||
54
screens/announcements/lib/type.ts
Normal file
54
screens/announcements/lib/type.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
export interface AnnouncementListBody {
|
||||
status: boolean;
|
||||
data: {
|
||||
links: {
|
||||
previous: string | null;
|
||||
next: string | null;
|
||||
};
|
||||
total_items: number;
|
||||
total_pages: number;
|
||||
page_size: number;
|
||||
current_page: number;
|
||||
results: AnnouncementListBodyRes[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface AnnouncementListBodyRes {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
total_view_count: number;
|
||||
files: [
|
||||
{
|
||||
file: string;
|
||||
}
|
||||
];
|
||||
status: 'pending' | 'paid' | 'verified' | 'canceled';
|
||||
types: {
|
||||
id: number;
|
||||
name: string;
|
||||
icon_name: string;
|
||||
}[];
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface AnnouncementDetailBody {
|
||||
status: boolean;
|
||||
data: {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
total_view_count: number;
|
||||
files: {
|
||||
id: number;
|
||||
file: string;
|
||||
}[];
|
||||
status: 'pending' | 'paid' | 'verified' | 'canceled';
|
||||
types: {
|
||||
id: number;
|
||||
name: string;
|
||||
icon_name: string;
|
||||
}[];
|
||||
created_at: string;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user