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

@ -13,6 +13,7 @@ export const CommentsAddModal = (props: {
token: string;
setShouldRender?: any;
setCommentSend?: any;
type?: "release" | "collection";
}) => {
const [message, setMessage] = useState(
props.isReply ? `${props.parentProfile.login}, ` : ""
@ -31,13 +32,18 @@ export const CommentsAddModal = (props: {
};
async function _send() {
const res = await fetch(
`${ENDPOINTS.release.info}/comment/add/${props.release_id}?token=${props.token}`,
{
method: "POST",
body: JSON.stringify(data),
}
);
let url;
if (props.type == "collection") {
url = `${ENDPOINTS.collection.base}/comment/add/${props.release_id}?token=${props.token}`;
} else {
url = `${ENDPOINTS.release.info}/comment/add/${props.release_id}?token=${props.token}`;
}
const res = await fetch(url, {
method: "POST",
body: JSON.stringify(data),
});
if (props.isReply && props.setShouldRender && props.setCommentSend) {
props.setShouldRender(true);