Fitur Delete Collection pada Anime - CuyAnimeList #89
Replies: 1 comment
-
sudah bisa ges terima kasih |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
`"use client"
import { Archive, Trash } from '@phosphor-icons/react/dist/ssr'
import React, { useState, useEffect } from 'react'
const CollectionButton = ({ anime_mal_id, user_email, anime_image, anime_title }) => {
const [isInCollection, setIsInCollection] = useState(false)
const [loading, setLoading] = useState(true)
useEffect(() => {
const checkCollectionStatus = async () => {
try {
const response = await fetch(
/api/v1/collection?anime_mal_id=${anime_mal_id}&user_email=${user_email}
)const result = await response.json()
if (result.status === 200) {
setIsInCollection(result.isInCollection)
}
} catch (error) {
console.error("Error fetching collection status:", error)
} finally {
setLoading(false)
}
}
}, [anime_mal_id, user_email])
const handleCollection = async(event) => {
event.preventDefault()
}
const handleDelete = async(event) => {
event.preventDefault()
}
if (loading) {
return
}
return (
<>
{isInCollection ? (
REMOVE FROM COLLECTION
) : (
ADD TO COLLECTION
)}
</>
)
}
export default CollectionButton
`
ini tombol delete nya kenapa ga keluar yak?
Beta Was this translation helpful? Give feedback.
All reactions