fix button sticker and API Sticket
This commit is contained in:
132
src/app/api/admin/sticker/route.ts
Normal file
132
src/app/api/admin/sticker/route.ts
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
import { prisma } from "@/lib";
|
||||||
|
import { data } from "autoprefixer";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export { GET, POST };
|
||||||
|
|
||||||
|
interface IPostSticker {
|
||||||
|
fileId: string;
|
||||||
|
emotions: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function POST(request: Request) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "POST") {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "Method not allowed" },
|
||||||
|
{ status: 405 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { fileId, emotions } = await request.json();
|
||||||
|
|
||||||
|
const newStiker = await prisma.sticker.create({
|
||||||
|
data: {
|
||||||
|
fileId,
|
||||||
|
MasterEmotions: {
|
||||||
|
connect: emotions.map((value: string) => ({ value })), // id = number[]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!newStiker) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "Gagal membuat stiker" },
|
||||||
|
{ status: 400 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: true, message: "Berhasil membuat stiker" },
|
||||||
|
{ status: 200 }
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error create sticker", error);
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "Failed to create sticker" },
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GET(request: Request) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "GET") {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "Method not allowed" },
|
||||||
|
{ status: 405 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let fixData;
|
||||||
|
const { searchParams } = new URL(request.url);
|
||||||
|
const search = searchParams.get("search");
|
||||||
|
const page = searchParams.get("page");
|
||||||
|
const dataTake = 10;
|
||||||
|
const dataSkip = Number(page) * dataTake - dataTake;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!page) {
|
||||||
|
fixData = await prisma.sticker.findMany({
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
MasterEmotions: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const data = await prisma.sticker.findMany({
|
||||||
|
skip: dataSkip,
|
||||||
|
take: dataTake,
|
||||||
|
where: {
|
||||||
|
MasterEmotions: {
|
||||||
|
some: {
|
||||||
|
value: {
|
||||||
|
contains: search ? search : "",
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
MasterEmotions: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nCount = await prisma.sticker.count({
|
||||||
|
where: {
|
||||||
|
MasterEmotions: {
|
||||||
|
some: {
|
||||||
|
value: {
|
||||||
|
contains: search ? search : "",
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
fixData = {
|
||||||
|
data: data,
|
||||||
|
nPage: _.ceil(nCount / dataTake),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: true, message: "Success get data sticker", data: fixData },
|
||||||
|
{ status: 200 }
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error get data sticker", error);
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "Error get data sticker" },
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,55 +1,8 @@
|
|||||||
import { prisma } from "@/lib";
|
import { prisma } from "@/lib";
|
||||||
import { data } from "autoprefixer";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export { GET, POST };
|
export { GET };
|
||||||
|
|
||||||
interface IPostSticker {
|
|
||||||
fileId: string;
|
|
||||||
emotions: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
async function POST(request: Request) {
|
|
||||||
const method = request.method;
|
|
||||||
if (method !== "POST") {
|
|
||||||
return NextResponse.json(
|
|
||||||
{ success: false, message: "Method not allowed" },
|
|
||||||
{ status: 405 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const { fileId, emotions } = await request.json();
|
|
||||||
|
|
||||||
const newStiker = await prisma.sticker.create({
|
|
||||||
data: {
|
|
||||||
fileId,
|
|
||||||
MasterEmotions: {
|
|
||||||
connect: emotions.map((value: string) => ({ value })), // id = number[]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!newStiker) {
|
|
||||||
return NextResponse.json(
|
|
||||||
{ success: false, message: "Gagal membuat stiker" },
|
|
||||||
{ status: 400 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NextResponse.json(
|
|
||||||
{ success: true, message: "Berhasil membuat stiker" },
|
|
||||||
{ status: 200 }
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error create sticker", error);
|
|
||||||
return NextResponse.json(
|
|
||||||
{ success: false, message: "Failed to create sticker" },
|
|
||||||
{ status: 500 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function GET(request: Request) {
|
async function GET(request: Request) {
|
||||||
const method = request.method;
|
const method = request.method;
|
||||||
@@ -62,30 +15,48 @@ async function GET(request: Request) {
|
|||||||
|
|
||||||
let fixData;
|
let fixData;
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const search = searchParams.get("search");
|
const emotion = searchParams.get("emotion");
|
||||||
const page = searchParams.get("page");
|
const page = searchParams.get("page");
|
||||||
const dataTake = 10
|
const dataTake = 10;
|
||||||
const dataSkip = Number(page) * dataTake - dataTake;
|
const dataSkip = Number(page) * dataTake - dataTake;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!page) {
|
if (!page) {
|
||||||
fixData = await prisma.sticker.findMany({
|
// Without page
|
||||||
|
const getData = await prisma.sticker.findMany({
|
||||||
orderBy: {
|
orderBy: {
|
||||||
createdAt: "desc",
|
createdAt: "desc",
|
||||||
},
|
},
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
MasterEmotions: {
|
||||||
|
some: {
|
||||||
|
value: {
|
||||||
|
contains: emotion ? emotion : "",
|
||||||
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
include: {
|
include: {
|
||||||
MasterEmotions: true,
|
MasterEmotions: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixData = {
|
||||||
|
data: getData,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
|
// With page
|
||||||
const data = await prisma.sticker.findMany({
|
const data = await prisma.sticker.findMany({
|
||||||
skip: dataSkip,
|
skip: dataSkip,
|
||||||
take: dataTake,
|
take: dataTake,
|
||||||
where: {
|
where: {
|
||||||
|
isActive: true,
|
||||||
MasterEmotions: {
|
MasterEmotions: {
|
||||||
some: {
|
some: {
|
||||||
value: {
|
value: {
|
||||||
contains: search ? search : "",
|
contains: emotion ? emotion : "",
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -101,10 +72,11 @@ async function GET(request: Request) {
|
|||||||
|
|
||||||
const nCount = await prisma.sticker.count({
|
const nCount = await prisma.sticker.count({
|
||||||
where: {
|
where: {
|
||||||
|
isActive: true,
|
||||||
MasterEmotions: {
|
MasterEmotions: {
|
||||||
some: {
|
some: {
|
||||||
value: {
|
value: {
|
||||||
contains: search ? search : "",
|
contains: emotion ? emotion : "",
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -119,7 +91,7 @@ async function GET(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ success: true, message: "Success get data sticker", data: fixData },
|
{ success: true, message: "Success get data sticker", res: fixData },
|
||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
export const apiGetStickerForUser = async ({ emotion }: { emotion?: string }) => {
|
||||||
|
try {
|
||||||
|
// Fetch token from cookie
|
||||||
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
|
if (!token) {
|
||||||
|
console.error("No token found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(`/api/sticker?emotion=${emotion || ""}`, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if the response is OK
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorData = await response.json().catch(() => null);
|
||||||
|
console.error("Failed to get sticker", response.statusText, errorData);
|
||||||
|
throw new Error(errorData?.message || "Failed to get sticker");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the JSON response
|
||||||
|
return await response.json();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error get sticker", error);
|
||||||
|
throw error; // Re-throw the error to handle it in the calling function
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,21 +1,40 @@
|
|||||||
import { ActionIcon, Box, Image, ScrollArea, SimpleGrid, Tooltip } from "@mantine/core";
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Box,
|
||||||
|
Image,
|
||||||
|
ScrollArea,
|
||||||
|
SimpleGrid,
|
||||||
|
Tooltip,
|
||||||
|
Loader,
|
||||||
|
Group,
|
||||||
|
} from "@mantine/core";
|
||||||
import { IconMoodSmileFilled } from "@tabler/icons-react";
|
import { IconMoodSmileFilled } from "@tabler/icons-react";
|
||||||
import { MainColor } from "../../color";
|
import { MainColor } from "../../color";
|
||||||
import { UIGlobal_Modal } from "../../ui";
|
import { UIGlobal_Modal } from "../../ui";
|
||||||
import { listStiker } from "../stiker";
|
|
||||||
import { insertStickerReactQuill } from "./react_quill_format_for_stiker";
|
import { insertStickerReactQuill } from "./react_quill_format_for_stiker";
|
||||||
|
import { APIs } from "@/lib";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: () => void;
|
open: () => void;
|
||||||
close: () => void;
|
close: () => void;
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
quillRef: any;
|
quillRef: any;
|
||||||
|
dataSticker: any;
|
||||||
|
listEmotions: any
|
||||||
}
|
}
|
||||||
export const Comp_ButtonSticker = ({open, close, opened, quillRef}: Props) => {
|
export const Comp_ButtonSticker = ({
|
||||||
|
open,
|
||||||
|
close,
|
||||||
|
opened,
|
||||||
|
quillRef,
|
||||||
|
dataSticker,
|
||||||
|
listEmotions,
|
||||||
|
}: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ActionIcon onClick={open} variant="transparent">
|
<ActionIcon onClick={open} variant="transparent" disabled={dataSticker.length === 0}>
|
||||||
<IconMoodSmileFilled color={MainColor.white} size={30} />
|
<IconMoodSmileFilled color={dataSticker.length === 0 ? "gray" : MainColor.white} size={30} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
|
|
||||||
<UIGlobal_Modal
|
<UIGlobal_Modal
|
||||||
@@ -23,22 +42,32 @@ export const Comp_ButtonSticker = ({open, close, opened, quillRef}: Props) => {
|
|||||||
close={close}
|
close={close}
|
||||||
title="Pilih Stiker"
|
title="Pilih Stiker"
|
||||||
closeButton
|
closeButton
|
||||||
|
closeOnClickOutside={false}
|
||||||
|
|
||||||
>
|
>
|
||||||
<Box mah={`${400}dvh`}>
|
<Box mah={`${500}dvh`}>
|
||||||
|
{/* <Group position="center">
|
||||||
|
{listEmotions.map((item: any) => (
|
||||||
|
<ActionIcon key={item.id} onClick={() => open()}>
|
||||||
|
<IconMoodSmileFilled color={item.value} size={30} />
|
||||||
|
</ActionIcon>
|
||||||
|
))}
|
||||||
|
</Group> */}
|
||||||
<ScrollArea h={380}>
|
<ScrollArea h={380}>
|
||||||
<SimpleGrid cols={3} spacing="md">
|
<SimpleGrid cols={3} spacing="md">
|
||||||
{listStiker.map((item) => (
|
{dataSticker.map((item: any) => (
|
||||||
<Box key={item.id}>
|
<Box key={item.id}>
|
||||||
<Tooltip label={item.name}>
|
<Tooltip label={item.name}>
|
||||||
<Image
|
<Image
|
||||||
src={item.url}
|
onLoad={() => <Loader />}
|
||||||
|
src={APIs.GET({ fileId: item.fileId })}
|
||||||
height={100}
|
height={100}
|
||||||
width={100}
|
width={100}
|
||||||
alt={item.name}
|
alt={item.name}
|
||||||
style={{ cursor: "pointer" }}
|
style={{ cursor: "pointer" }}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
insertStickerReactQuill({
|
insertStickerReactQuill({
|
||||||
stickerUrl: item.url,
|
stickerUrl: APIs.GET({ fileId: item.fileId }),
|
||||||
quillRef: quillRef,
|
quillRef: quillRef,
|
||||||
close: close,
|
close: close,
|
||||||
})
|
})
|
||||||
@@ -53,4 +82,4 @@ export const Comp_ButtonSticker = ({open, close, opened, quillRef}: Props) => {
|
|||||||
</UIGlobal_Modal>
|
</UIGlobal_Modal>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export default function UIGlobal_Modal({
|
|||||||
buttonKanan,
|
buttonKanan,
|
||||||
children,
|
children,
|
||||||
closeButton,
|
closeButton,
|
||||||
|
closeOnClickOutside,
|
||||||
}: {
|
}: {
|
||||||
opened: any;
|
opened: any;
|
||||||
close: any;
|
close: any;
|
||||||
@@ -29,6 +30,7 @@ export default function UIGlobal_Modal({
|
|||||||
buttonKanan?: any;
|
buttonKanan?: any;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
closeButton?: boolean;
|
closeButton?: boolean;
|
||||||
|
closeOnClickOutside?: boolean;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -39,6 +41,7 @@ export default function UIGlobal_Modal({
|
|||||||
}}
|
}}
|
||||||
centered
|
centered
|
||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
|
closeOnClickOutside={closeOnClickOutside}
|
||||||
styles={{
|
styles={{
|
||||||
content: {
|
content: {
|
||||||
backgroundColor: MainColor.darkblue,
|
backgroundColor: MainColor.darkblue,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const apiAdminCreateSticker = async ({ data }: { data: any }) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`/api/sticker`, {
|
const response = await fetch(`/api/admin/sticker`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -41,7 +41,7 @@ export const apiAdminGetSticker = async ({ page }: { page: number }) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`/api/sticker?page=${page}`, {
|
const response = await fetch(`/api/admin/sticker?page=${page}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -74,7 +74,7 @@ export const apiAdminGetStickerById = async ({ id }: { id: string }) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`/api/sticker/${id}`, {
|
const response = await fetch(`/api/admin/sticker/${id}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -108,7 +108,7 @@ export const apiAdminUpdateSticker = async ({ data }: { data: any }) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`/api/sticker/${data.id}`, {
|
const response = await fetch(`/api/admin/sticker/${data.id}`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -142,7 +142,7 @@ export const apiAdminDeleteSticker = async ({ id }: { id: string }) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`/api/sticker/${id}`, {
|
const response = await fetch(`/api/admin/sticker/${id}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -175,7 +175,7 @@ export const apiAdminUpdateStatusStickerById = async ({ data }: { data: any }) =
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`/api/sticker/${data.id}/activation`, {
|
const response = await fetch(`/api/admin/sticker/${data.id}/activation`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import { useDisclosure, useShallowEffect } from "@mantine/hooks";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import Forum_ButtonCreatePosting from "../component/button/button_create_posting";
|
import Forum_ButtonCreatePosting from "../component/button/button_create_posting";
|
||||||
|
import { apiGetStickerForUser } from "@/app_modules/_global/lib/stiker/api_fecth_stiker_for_user";
|
||||||
|
import { apiGetMasterEmotions } from "@/app_modules/_global/lib/api_fetch_master";
|
||||||
|
|
||||||
export function Forum_V3_Create() {
|
export function Forum_V3_Create() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -19,6 +21,45 @@ export function Forum_V3_Create() {
|
|||||||
const quillRef = React.useRef<any>(null);
|
const quillRef = React.useRef<any>(null);
|
||||||
const [quillLoaded, setQuillLoaded] = useState<boolean>(false);
|
const [quillLoaded, setQuillLoaded] = useState<boolean>(false);
|
||||||
const [isReady, setIsReady] = useState<boolean>(false);
|
const [isReady, setIsReady] = useState<boolean>(false);
|
||||||
|
const [sticker, setSticker] = useState<any>([]);
|
||||||
|
const [emotion, setEmotion] = useState<any>([]);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
onLoadSticker();
|
||||||
|
onLoadEmotion();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function onLoadSticker() {
|
||||||
|
try {
|
||||||
|
const response = await apiGetStickerForUser({ emotion });
|
||||||
|
console.log("response >>", response);
|
||||||
|
if (response.success) {
|
||||||
|
setSticker(response.res.data);
|
||||||
|
} else {
|
||||||
|
console.error("Failed to get sticker", response.message);
|
||||||
|
setSticker([]);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error get sticker", error);
|
||||||
|
setSticker([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onLoadEmotion() {
|
||||||
|
try {
|
||||||
|
const response = await apiGetMasterEmotions();
|
||||||
|
console.log("response >>", response);
|
||||||
|
if (response.success) {
|
||||||
|
setEmotion(response.data);
|
||||||
|
} else {
|
||||||
|
console.error("Failed to get emotion", response.message);
|
||||||
|
setEmotion([]);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error get emotion", error);
|
||||||
|
setEmotion([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
setIsReady(true); // Set ready on client-side mount
|
setIsReady(true); // Set ready on client-side mount
|
||||||
@@ -82,6 +123,8 @@ export function Forum_V3_Create() {
|
|||||||
close={close}
|
close={close}
|
||||||
opened={opened}
|
opened={opened}
|
||||||
quillRef={quillRef}
|
quillRef={quillRef}
|
||||||
|
dataSticker={sticker}
|
||||||
|
listEmotions={emotion}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Forum_ButtonCreatePosting value={editorContent} />
|
<Forum_ButtonCreatePosting value={editorContent} />
|
||||||
|
|||||||
Reference in New Issue
Block a user