category name bug fix

This commit is contained in:
VividTruthKeeper 2023-03-05 21:52:42 +05:00
parent 3f90611554
commit 73a70d949c
4 changed files with 45 additions and 3 deletions

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View File

@ -6,7 +6,7 @@
<meta name="description" id="meta-description" content="" />
<meta name="keywords" id="meta-keywords" content="" />
<title>Türkmenistan Habarlar Portaly</title>
<script type="module" crossorigin src="/assets/index-20511609.js"></script>
<script type="module" crossorigin src="/assets/index-42dcf52a.js"></script>
<link rel="stylesheet" href="/assets/index-f119abb1.css">
</head>
<body>

View File

@ -47,7 +47,7 @@ const Aside = ({ type }: Props) => {
key={uuidv4()}
title={el.title}
date={el.published_at}
category={el.categories[0].name}
category={el.categories[0] ? el.categories[0].name : ""}
img={
el.featured_images[0] ? el.featured_images[0].path : ""
}

42
src/types/posts.types.ts Normal file
View File

@ -0,0 +1,42 @@
export interface IPostsData {
status_code: number;
message: string;
data: Data;
}
export interface Data {
current_page: number;
data: Datum[];
first_page_url: string;
from: number;
last_page: number;
last_page_url: string;
next_page_url: string;
path: string;
per_page: string;
prev_page_url: null;
to: number;
total: number;
}
export interface Datum {
id: number;
title: string;
slug: string;
excerpt: string;
published_at: string;
summary: string;
has_summary: boolean;
categories: Category[];
}
export interface Category {
id: number;
name: string;
pivot: Pivot;
}
export interface Pivot {
post_id: number;
category_id: number;
}