mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-19 16:04:41 +00:00
fix?: error if failed to get comment replies
This commit is contained in:
parent
ed96dd301c
commit
9d92c884e8
1 changed files with 27 additions and 23 deletions
|
@ -84,9 +84,17 @@ export const CommentsComment = (props: {
|
|||
url += `&token=${props.token}`;
|
||||
}
|
||||
await fetch(url)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (res.ok) {
|
||||
return res.json();
|
||||
} else {
|
||||
return { content: [] };
|
||||
}
|
||||
})
|
||||
.then((data) => {
|
||||
if (data && data.content) {
|
||||
setReplies(data.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (
|
||||
|
@ -194,8 +202,8 @@ export const CommentsComment = (props: {
|
|||
</footer>
|
||||
<div className="relative flex items-center py-2">
|
||||
<p className="text-gray-800 whitespace-pre-wrap dark:text-gray-400">
|
||||
{!props.comment.isDeleted
|
||||
? props.comment.message
|
||||
{!props.comment.isDeleted ?
|
||||
props.comment.message
|
||||
: "Комментарий был удалён."}
|
||||
</p>
|
||||
{isHidden && (
|
||||
|
@ -205,8 +213,8 @@ export const CommentsComment = (props: {
|
|||
>
|
||||
<div className="min-w-full min-h-full px-2 py-1.5 rounded-md bg-black text-white bg-opacity-50 backdrop-blur-[8px] flex flex-col justify-center items-center">
|
||||
<p>
|
||||
{props.comment.likes_count < -5
|
||||
? "У комментария слишком низкий рейтинг."
|
||||
{props.comment.likes_count < -5 ?
|
||||
"У комментария слишком низкий рейтинг."
|
||||
: "Данный комментарий может содержать спойлер."}
|
||||
</p>
|
||||
<p className="font-bold">Нажмите, чтобы прочитать</p>
|
||||
|
@ -220,7 +228,7 @@ export const CommentsComment = (props: {
|
|||
isHidden ? "mt-4" : ""
|
||||
}`}
|
||||
>
|
||||
{props.token ? (
|
||||
{props.token ?
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center text-sm font-medium text-gray-500 hover:underline dark:text-gray-400"
|
||||
|
@ -243,9 +251,7 @@ export const CommentsComment = (props: {
|
|||
</svg>
|
||||
Ответить
|
||||
</button>
|
||||
) : (
|
||||
<span></span>
|
||||
)}
|
||||
: <span></span>}
|
||||
<div className="flex items-center">
|
||||
<Button
|
||||
color="inline"
|
||||
|
@ -256,18 +262,16 @@ export const CommentsComment = (props: {
|
|||
>
|
||||
<span
|
||||
className={`w-6 h-6 iconify mdi--dislike ${
|
||||
vote == 1
|
||||
? "text-red-500 dark:text-red-400"
|
||||
vote == 1 ?
|
||||
"text-red-500 dark:text-red-400"
|
||||
: "text-gray-500 dark:text-gray-400"
|
||||
}`}
|
||||
></span>
|
||||
</Button>
|
||||
<p
|
||||
className={`text-sm font-medium ${
|
||||
likes > 0
|
||||
? "text-green-500 dark:text-green-400"
|
||||
: likes < 0
|
||||
? "text-red-500 dark:text-red-400"
|
||||
likes > 0 ? "text-green-500 dark:text-green-400"
|
||||
: likes < 0 ? "text-red-500 dark:text-red-400"
|
||||
: "text-gray-500 dark:text-gray-400"
|
||||
}`}
|
||||
>
|
||||
|
@ -282,8 +286,8 @@ export const CommentsComment = (props: {
|
|||
>
|
||||
<span
|
||||
className={`w-6 h-6 iconify mdi--like ${
|
||||
vote == 2
|
||||
? "text-green-500 dark:text-green-400"
|
||||
vote == 2 ?
|
||||
"text-green-500 dark:text-green-400"
|
||||
: "text-gray-500 dark:text-gray-400"
|
||||
}`}
|
||||
></span>
|
||||
|
|
Loading…
Add table
Reference in a new issue