commit
This commit is contained in:
parent
015ac84e20
commit
e38ff51c39
|
|
@ -7,7 +7,7 @@ import { ChannelsModel } from '@/models/channels.model';
|
|||
import { HomeModel } from '@/models/home.model';
|
||||
import { LiveDescriptionModel } from '@/models/liveDescription.model';
|
||||
import { MarqueeModel } from '@/models/marquee.model';
|
||||
import { NewsModel } from '@/models/news.model';
|
||||
import { NewsModel, NewsType } from '@/models/news.model';
|
||||
import { NewsItemModel } from '@/models/newsItem.model';
|
||||
import { PageItemModel } from '@/models/pageItem.model';
|
||||
import { PlansModel } from '@/models/plans.model';
|
||||
|
|
@ -37,11 +37,17 @@ export class Queries {
|
|||
}
|
||||
|
||||
public static async getlastNews(): Promise<NewsModel> {
|
||||
return await fetch(`https://turkmentv.gov.tm/v2/api/slider?type=small3`, {
|
||||
return await fetch(`${baseUrl.NEWS_SRC}${routes.news}?locale=tm&count=5`, {
|
||||
next: { revalidate: 3600 },
|
||||
}).then((res) => res.json().then((res) => res as NewsModel));
|
||||
}
|
||||
|
||||
public static async getHomeBanner3(): Promise<NewsType> {
|
||||
return await fetch(`https://turkmentv.gov.tm/v2/api/slider?type=small3`, {
|
||||
next: { revalidate: 3600 },
|
||||
}).then((res) => res.json().then((res) => res as NewsType));
|
||||
}
|
||||
|
||||
public static async getNewsItem(id: string): Promise<NewsItemModel> {
|
||||
return await fetch(`${baseUrl.NEWS_SRC}${routes.newsItem(id)}?locale=tm`, {
|
||||
next: { revalidate: 3600 },
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import LinkBlock from './LinkBlock';
|
|||
const SmallSwiperNews = () => {
|
||||
const { data, isFetching, error } = useQuery({
|
||||
queryKey: ['small_slider_news'],
|
||||
queryFn: () => Queries.getlastNews(),
|
||||
queryFn: () => Queries.getHomeBanner3(),
|
||||
});
|
||||
|
||||
if (isFetching) return <Loader height={'100%'} />;
|
||||
|
|
|
|||
|
|
@ -1,82 +1,82 @@
|
|||
// export interface NewsModel {
|
||||
// data: Datum[];
|
||||
// links: Links;
|
||||
// meta: Meta;
|
||||
// }
|
||||
|
||||
// export interface Datum {
|
||||
// id: number;
|
||||
// title: string;
|
||||
// slug: string;
|
||||
// excerpt: string;
|
||||
// published_at: string;
|
||||
// type: Type;
|
||||
// awtor: Awtor;
|
||||
// featured_images: FeaturedImage[];
|
||||
// video: string;
|
||||
// categories: Category[];
|
||||
// }
|
||||
|
||||
// export enum Awtor {
|
||||
// Hhm = "HHM",
|
||||
// Миц = "МИЦ",
|
||||
// Ннм = "ННМ",
|
||||
// }
|
||||
|
||||
// export interface Category {
|
||||
// id: number;
|
||||
// name: string;
|
||||
// powerseo_title: Powerseo | null;
|
||||
// powerseo_description: Powerseo | null;
|
||||
// powerseo_keywords: Powerseo | null;
|
||||
// }
|
||||
|
||||
// export enum Powerseo {
|
||||
// Novosti = "Novosti",
|
||||
// VTurkmenistane = "V Turkmenistane",
|
||||
// }
|
||||
|
||||
// export interface FeaturedImage {
|
||||
// id: number;
|
||||
// disk_name: string;
|
||||
// file_name: string;
|
||||
// path: string;
|
||||
// extension: Extension;
|
||||
// }
|
||||
|
||||
// export enum Extension {
|
||||
// JPEG = "jpeg",
|
||||
// Jpg = "jpg",
|
||||
// PNG = "png",
|
||||
// }
|
||||
|
||||
// export enum Type {
|
||||
// Photo = "photo",
|
||||
// Video = "video",
|
||||
// }
|
||||
|
||||
// export interface Links {
|
||||
// first: string;
|
||||
// last: string;
|
||||
// prev: null;
|
||||
// next: string;
|
||||
// }
|
||||
|
||||
// export interface Meta {
|
||||
// current_page: number;
|
||||
// from: number;
|
||||
// last_page: number;
|
||||
// path: string;
|
||||
// per_page: number;
|
||||
// to: number;
|
||||
// total: number;
|
||||
// }
|
||||
|
||||
export interface NewsModel {
|
||||
data: Datum[];
|
||||
links: Links;
|
||||
meta: Meta;
|
||||
}
|
||||
|
||||
export interface Datum {
|
||||
id: number;
|
||||
title: string;
|
||||
slug: string;
|
||||
excerpt: string;
|
||||
published_at: string;
|
||||
type: Type;
|
||||
awtor: Awtor;
|
||||
featured_images: FeaturedImage[];
|
||||
video: string;
|
||||
categories: Category[];
|
||||
}
|
||||
|
||||
export enum Awtor {
|
||||
Hhm = 'HHM',
|
||||
Миц = 'МИЦ',
|
||||
Ннм = 'ННМ',
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
id: number;
|
||||
name: string;
|
||||
powerseo_title: Powerseo | null;
|
||||
powerseo_description: Powerseo | null;
|
||||
powerseo_keywords: Powerseo | null;
|
||||
}
|
||||
|
||||
export enum Powerseo {
|
||||
Novosti = 'Novosti',
|
||||
VTurkmenistane = 'V Turkmenistane',
|
||||
}
|
||||
|
||||
export interface FeaturedImage {
|
||||
id: number;
|
||||
disk_name: string;
|
||||
file_name: string;
|
||||
path: string;
|
||||
extension: Extension;
|
||||
}
|
||||
|
||||
export enum Extension {
|
||||
JPEG = 'jpeg',
|
||||
Jpg = 'jpg',
|
||||
PNG = 'png',
|
||||
}
|
||||
|
||||
export enum Type {
|
||||
Photo = 'photo',
|
||||
Video = 'video',
|
||||
}
|
||||
|
||||
export interface Links {
|
||||
first: string;
|
||||
last: string;
|
||||
prev: null;
|
||||
next: string;
|
||||
}
|
||||
|
||||
export interface Meta {
|
||||
current_page: number;
|
||||
from: number;
|
||||
last_page: number;
|
||||
path: string;
|
||||
per_page: number;
|
||||
to: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface NewsType {
|
||||
data: Datu[];
|
||||
}
|
||||
|
||||
export interface Datu {
|
||||
id: number;
|
||||
title: string;
|
||||
url: null | string;
|
||||
|
|
|
|||
Loading…
Reference in New Issue