feat: add collections comments

This commit is contained in:
Kentai Radiquum 2024-08-18 18:36:22 +05:00
parent 501d3a1705
commit 33d34938c6
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
8 changed files with 143 additions and 73 deletions

View file

@ -9,6 +9,7 @@ export const CommentsEditModal = (props: {
token: string;
setShouldRender?: any;
setCommentSend?: any;
type?: "release" | "collection";
}) => {
const [message, setMessage] = useState(props.parentComment.message);
const [isSpoiler, setIsSpoiler] = useState(props.parentComment.isSpoiler);
@ -23,13 +24,16 @@ export const CommentsEditModal = (props: {
};
async function _send() {
const res = await fetch(
`${ENDPOINTS.release.info}/comment/edit/${props.parentComment.id}?token=${props.token}`,
{
method: "POST",
body: JSON.stringify(data),
}
);
let url;
if (props.type == "collection") {
url = `${ENDPOINTS.collection.base}/comment/edit/${props.parentComment.id}?token=${props.token}`;
} else {
url = `${ENDPOINTS.release.info}/comment/edit/${props.parentComment.id}?token=${props.token}`;
}
const res = await fetch(url, {
method: "POST",
body: JSON.stringify(data),
});
if (props.setShouldRender && props.setCommentSend) {
props.setShouldRender(true);