This commit is contained in:
Kakabay 2024-10-23 16:20:07 +05:00
parent 89f563278f
commit 015ac84e20
4 changed files with 85 additions and 69 deletions

View File

@ -37,7 +37,7 @@ export class Queries {
}
public static async getlastNews(): Promise<NewsModel> {
return await fetch(`${baseUrl.NEWS_SRC}${routes.news}?locale=tm&count=5`, {
return await fetch(`https://turkmentv.gov.tm/v2/api/slider?type=small3`, {
next: { revalidate: 3600 },
}).then((res) => res.json().then((res) => res as NewsModel));
}

View File

@ -1,8 +1,7 @@
'use client';
// src/app/layout.tsx
import { AuthProvider } from '@/context/AuthContext';
import { SmsContext, SmsProvider } from '@/context/SmsContext';
import { PropsWithChildren, useState } from 'react';
import { PropsWithChildren } from 'react';
export default function SmsLayout({ children }: PropsWithChildren) {
return (

View File

@ -42,7 +42,7 @@ const SmallSwiperNews = () => {
<Link href={item ? `news/${item.id}` : ''} className="relative ">
<div className="relative w-full h-full">
<Image
src={item.featured_images[0].path}
src={item.image}
alt="small_banner"
fill
unoptimized

View File

@ -1,73 +1,90 @@
// 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;
url: null | string;
image: string;
type: string;
status: number;
description: null;
page_id: null;
created_at: Date;
updated_at: Date;
}