diff --git a/Dockerfile b/Dockerfile index e702a914..c3ca946c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,12 @@ COPY package*.json pnpm-lock.yaml* /usr/src/app/ COPY vendor/ckeditor5 /usr/src/app/ # Install dependencies using pnpm -RUN npm install next --legacy-peer-deps -RUN pnpm install -RUN pnpm add next-intl -RUN pnpm add nextra +# RUN npm install next --legacy-peer-deps +# RUN pnpm install +# RUN pnpm add next-intl +# RUN pnpm add nextra +RUN pnpm install --frozen-lockfile + # Copying source files COPY . /usr/src/app diff --git a/app/[locale]/(protected)/admin/broadcast/campaign-list/account-list/component/table.tsx b/app/[locale]/(protected)/admin/broadcast/campaign-list/account-list/component/table.tsx index eb8b3e22..b055ddbe 100644 --- a/app/[locale]/(protected)/admin/broadcast/campaign-list/account-list/component/table.tsx +++ b/app/[locale]/(protected)/admin/broadcast/campaign-list/account-list/component/table.tsx @@ -99,7 +99,7 @@ const AccountListTable = () => { page - 1, filtered ? filtered.join(",") : "" ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * 10 + index + 1; diff --git a/app/[locale]/(protected)/admin/broadcast/campaign-list/component/table.tsx b/app/[locale]/(protected)/admin/broadcast/campaign-list/component/table.tsx index f56cf0ab..13e8e641 100644 --- a/app/[locale]/(protected)/admin/broadcast/campaign-list/component/table.tsx +++ b/app/[locale]/(protected)/admin/broadcast/campaign-list/component/table.tsx @@ -125,7 +125,7 @@ const CampaignListTable = () => { try { loading(); const res = await getMediaBlastCampaignPage(page - 1); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * 10 + index + 1; diff --git a/app/[locale]/(protected)/admin/broadcast/component/table.tsx b/app/[locale]/(protected)/admin/broadcast/component/table.tsx index 338cd31d..fbb67a28 100644 --- a/app/[locale]/(protected)/admin/broadcast/component/table.tsx +++ b/app/[locale]/(protected)/admin/broadcast/component/table.tsx @@ -151,7 +151,7 @@ const BroadcastTable = () => { categoryFilter?.sort().join(","), statusFilter?.sort().join(",") ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * Number(showData) + index + 1; diff --git a/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx b/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx index 6c15973b..2ce35a53 100644 --- a/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx +++ b/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx @@ -81,7 +81,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => { const res = await getAgendaSettingsList(INITIAL_YEAR, INITIAL_MONTH, ""); console.log("API Response:", res); - if (res.error) { + if (res?.error) { return; } diff --git a/app/[locale]/(protected)/contributor/blog/components/blog-table.tsx b/app/[locale]/(protected)/contributor/blog/components/blog-table.tsx index 32c794d6..9bee71a1 100644 --- a/app/[locale]/(protected)/contributor/blog/components/blog-table.tsx +++ b/app/[locale]/(protected)/contributor/blog/components/blog-table.tsx @@ -92,7 +92,7 @@ const BlogTable = () => { async function fetchData() { try { const res = await paginationBlog(limit, page - 1, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/content/audio/components/table-audio.tsx b/app/[locale]/(protected)/contributor/content/audio/components/table-audio.tsx index fdbfd63f..3f42e5e1 100644 --- a/app/[locale]/(protected)/contributor/content/audio/components/table-audio.tsx +++ b/app/[locale]/(protected)/contributor/content/audio/components/table-audio.tsx @@ -142,7 +142,7 @@ const TableAudio = () => { endDateString, search ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx b/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx index c0908cfd..0e0c52e7 100644 --- a/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx +++ b/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx @@ -138,7 +138,7 @@ const TableImage = () => { endDateString, search ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/content/nulis-ai/components/table-nulis.tsx b/app/[locale]/(protected)/contributor/content/nulis-ai/components/table-nulis.tsx index 864f65b7..b670ddde 100644 --- a/app/[locale]/(protected)/contributor/content/nulis-ai/components/table-nulis.tsx +++ b/app/[locale]/(protected)/contributor/content/nulis-ai/components/table-nulis.tsx @@ -127,7 +127,7 @@ const TableTeks = () => { try { const isForSelf = Number(roleId) == 4; const res = await listNulisAI(limit, page - 1, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx b/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx index 36658412..03434a54 100644 --- a/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx +++ b/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx @@ -128,7 +128,7 @@ const TableSPIT = () => { try { const res = await listSPIT(page - 1, limit, search, isPublish); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/content/teks/components/table-teks.tsx b/app/[locale]/(protected)/contributor/content/teks/components/table-teks.tsx index 79799154..6cda6a2f 100644 --- a/app/[locale]/(protected)/contributor/content/teks/components/table-teks.tsx +++ b/app/[locale]/(protected)/contributor/content/teks/components/table-teks.tsx @@ -138,7 +138,7 @@ const TableTeks = () => { endDateString, search ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/content/video/components/table-video.tsx b/app/[locale]/(protected)/contributor/content/video/components/table-video.tsx index d4b3c9bc..c5b2bd8e 100644 --- a/app/[locale]/(protected)/contributor/content/video/components/table-video.tsx +++ b/app/[locale]/(protected)/contributor/content/video/components/table-video.tsx @@ -138,7 +138,7 @@ const TableImage = () => { endDateString, search ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx b/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx index 352174fd..1a3c8ae7 100644 --- a/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx +++ b/app/[locale]/(protected)/contributor/planning/mediahub/components/mediahub-table.tsx @@ -111,7 +111,7 @@ const MediahubTable = () => { async function fetchData() { try { const res = await getPlanningSentPagination(limit, page - 1, 1, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx b/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx index fb4e1743..e0fba90d 100644 --- a/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx +++ b/app/[locale]/(protected)/contributor/planning/medsos-mediahub/components/medsos-table.tsx @@ -110,7 +110,7 @@ const MedsosTable = () => { async function fetchData() { try { const res = await getPlanningSentPagination(limit, page - 1, 2, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx b/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx index 4e58ef1a..a927feaa 100644 --- a/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/event/components/event-table.tsx @@ -87,7 +87,7 @@ const EventTable = () => { async function fetchData() { try { const res = await paginationSchedule(limit, page - 1, 2, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx b/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx index 5fa152f1..35e12580 100644 --- a/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/press-conference/components/presscon-table.tsx @@ -100,7 +100,7 @@ const PressConferenceTable = () => { async function fetchData() { try { const res = await paginationSchedule(limit, page - 1, 1, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx b/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx index a66fb7ec..b9391727 100644 --- a/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/press-release/components/pressrilis-table.tsx @@ -101,7 +101,7 @@ const PressReleaseTable = () => { async function fetchData() { try { const res = await paginationSchedule(limit, page - 1, 3, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/contributor/task/components/task-table.tsx b/app/[locale]/(protected)/contributor/task/components/task-table.tsx index 69636f6a..7a089b02 100644 --- a/app/[locale]/(protected)/contributor/task/components/task-table.tsx +++ b/app/[locale]/(protected)/contributor/task/components/task-table.tsx @@ -116,7 +116,7 @@ const TaskTable = () => { limit, isSpecificAttention ? "atensi-khusus" : "tugas-harian" ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/components/table.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/components/table.tsx index 68cd40ee..800309d1 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/components/table.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/components/table.tsx @@ -112,7 +112,7 @@ const TaskPlanMediahubTable = (props: { async function fetchData() { // try { // const res = await ticketingPagination("", limit, page - 1); - // const data = res.data?.data; + // const data = res?.data?.data; console.log("datgaa", data); const contentData = data; contentData.forEach((item: any, index: number) => { diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/detail/[id]/page.tsx index 1cc0d504..afcef05f 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/detail/[id]/page.tsx @@ -170,8 +170,8 @@ export default function DetailDaily() { async function getWeeklyPlanning() { const res = await getWeeklyPlanList(new Date().getDate(), 1); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx index 81097090..9697b9e2 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/edit/[id]/page.tsx @@ -184,8 +184,8 @@ export default function EditDaily() { async function getWeeklyPlanning() { const res = await getWeeklyPlanList(new Date().getDate(), 1); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx index 3c86ab34..fc166890 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-daily/page.tsx @@ -132,8 +132,8 @@ export default function CreateDaily() { async function getWeeklyPlanning() { const res = await getWeeklyPlanList(new Date().getDate(), 1); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx index 0e47f5bc..6f854743 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/page.tsx @@ -136,8 +136,8 @@ export default function CreateMonthly() { async function getMonthlyPlanning() { const res = await getMonthlyPlanList(new Date().getDate(), 1); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/detail/[id]/page.tsx index 68451be8..d0d545cd 100644 --- a/app/[locale]/(protected)/curator/task-plan/mediahub/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/mediahub/detail/[id]/page.tsx @@ -106,8 +106,8 @@ export default function DetailTaskPlanMediahub() { const TODAY = dayjs().format("YYYY-MM-DD"); const res = await getWeeklyPlanList(planningData?.date || TODAY, 1); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/table.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/table.tsx index 68cd40ee..800309d1 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/table.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/components/table.tsx @@ -112,7 +112,7 @@ const TaskPlanMediahubTable = (props: { async function fetchData() { // try { // const res = await ticketingPagination("", limit, page - 1); - // const data = res.data?.data; + // const data = res?.data?.data; console.log("datgaa", data); const contentData = data; contentData.forEach((item: any, index: number) => { diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx index e2c2d8a8..c739bc83 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-daily/page.tsx @@ -168,8 +168,8 @@ export default function CreateMonthly() { async function getWeeklyPlanning() { const res = await getWeeklyPlanList(new Date().getDate(), 2); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx index 65f78639..e3707a90 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/page.tsx @@ -135,8 +135,8 @@ export default function CreateMonthly() { async function getMonthlyPlanning() { const res = await getMonthlyPlanList(new Date().getDate(), 2); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/detail/[id]/page.tsx index 68451be8..d0d545cd 100644 --- a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/detail/[id]/page.tsx @@ -106,8 +106,8 @@ export default function DetailTaskPlanMediahub() { const TODAY = dayjs().format("YYYY-MM-DD"); const res = await getWeeklyPlanList(planningData?.date || TODAY, 1); - if (res.data !== null) { - const rawUser = res.data?.data; + if (res?.data !== null) { + const rawUser = res?.data?.data; const optionArr = rawUser.map((option: any) => ({ id: option.id, label: option.title, diff --git a/app/[locale]/(protected)/dashboard/routine-task/components/content-table.tsx b/app/[locale]/(protected)/dashboard/routine-task/components/content-table.tsx index a8d3b6de..049f3e58 100644 --- a/app/[locale]/(protected)/dashboard/routine-task/components/content-table.tsx +++ b/app/[locale]/(protected)/dashboard/routine-task/components/content-table.tsx @@ -148,7 +148,7 @@ const ContentTable = () => { endDateString, search ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/dashboard/routine-task/components/recent-activity.tsx b/app/[locale]/(protected)/dashboard/routine-task/components/recent-activity.tsx index 3b01f6ca..faa218dd 100644 --- a/app/[locale]/(protected)/dashboard/routine-task/components/recent-activity.tsx +++ b/app/[locale]/(protected)/dashboard/routine-task/components/recent-activity.tsx @@ -93,7 +93,7 @@ const RecentActivity: React.FC = () => { startDateString, endDateString ); - const data = res.data?.data; + const data = res?.data?.data; const { content } = data || []; // Calculate counts for each typeId diff --git a/app/[locale]/(protected)/shared/communication/collaboration/components/collabroation-table.tsx b/app/[locale]/(protected)/shared/communication/collaboration/components/collabroation-table.tsx index 3f1dcc30..99babc44 100644 --- a/app/[locale]/(protected)/shared/communication/collaboration/components/collabroation-table.tsx +++ b/app/[locale]/(protected)/shared/communication/collaboration/components/collabroation-table.tsx @@ -135,7 +135,7 @@ const EscalationTable = () => { limit, search ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/shared/communication/escalation/components/escalation-table.tsx b/app/[locale]/(protected)/shared/communication/escalation/components/escalation-table.tsx index acfc1496..2de9aa1e 100644 --- a/app/[locale]/(protected)/shared/communication/escalation/components/escalation-table.tsx +++ b/app/[locale]/(protected)/shared/communication/escalation/components/escalation-table.tsx @@ -134,7 +134,7 @@ const EscalationTable = () => { limit, search ); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/shared/communication/internal/components/internal-table.tsx b/app/[locale]/(protected)/shared/communication/internal/components/internal-table.tsx index a9a4862c..34a917e0 100644 --- a/app/[locale]/(protected)/shared/communication/internal/components/internal-table.tsx +++ b/app/[locale]/(protected)/shared/communication/internal/components/internal-table.tsx @@ -129,7 +129,7 @@ const TableAudio = () => { async function fetchData() { try { const res = await listTicketingInternal(page - 1, limit, search); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/shared/contest/components/contest-table.tsx b/app/[locale]/(protected)/shared/contest/components/contest-table.tsx index f04e94c0..135fe118 100644 --- a/app/[locale]/(protected)/shared/contest/components/contest-table.tsx +++ b/app/[locale]/(protected)/shared/contest/components/contest-table.tsx @@ -100,7 +100,7 @@ const TaskTable = () => { async function fetchData() { try { const res = await listContest(search, limit, page - 1); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(protected)/supervisor/communications/account-report/components/table.tsx b/app/[locale]/(protected)/supervisor/communications/account-report/components/table.tsx index d55a7c38..b8a5f027 100644 --- a/app/[locale]/(protected)/supervisor/communications/account-report/components/table.tsx +++ b/app/[locale]/(protected)/supervisor/communications/account-report/components/table.tsx @@ -107,7 +107,7 @@ const FaqTable = () => { async function fetchData() { try { const res = await getFaqList(); - const contentData = res.data?.data; + const contentData = res?.data?.data; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; }); diff --git a/app/[locale]/(protected)/supervisor/communications/collaboration/components/table.tsx b/app/[locale]/(protected)/supervisor/communications/collaboration/components/table.tsx index d55a7c38..b8a5f027 100644 --- a/app/[locale]/(protected)/supervisor/communications/collaboration/components/table.tsx +++ b/app/[locale]/(protected)/supervisor/communications/collaboration/components/table.tsx @@ -107,7 +107,7 @@ const FaqTable = () => { async function fetchData() { try { const res = await getFaqList(); - const contentData = res.data?.data; + const contentData = res?.data?.data; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; }); diff --git a/app/[locale]/(protected)/supervisor/communications/forward/components/table.tsx b/app/[locale]/(protected)/supervisor/communications/forward/components/table.tsx index d55a7c38..b8a5f027 100644 --- a/app/[locale]/(protected)/supervisor/communications/forward/components/table.tsx +++ b/app/[locale]/(protected)/supervisor/communications/forward/components/table.tsx @@ -107,7 +107,7 @@ const FaqTable = () => { async function fetchData() { try { const res = await getFaqList(); - const contentData = res.data?.data; + const contentData = res?.data?.data; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; }); diff --git a/app/[locale]/(protected)/supervisor/communications/internal/components/table.tsx b/app/[locale]/(protected)/supervisor/communications/internal/components/table.tsx index d55a7c38..b8a5f027 100644 --- a/app/[locale]/(protected)/supervisor/communications/internal/components/table.tsx +++ b/app/[locale]/(protected)/supervisor/communications/internal/components/table.tsx @@ -107,7 +107,7 @@ const FaqTable = () => { async function fetchData() { try { const res = await getFaqList(); - const contentData = res.data?.data; + const contentData = res?.data?.data; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; }); diff --git a/app/[locale]/(protected)/supervisor/communications/questions/components/table.tsx b/app/[locale]/(protected)/supervisor/communications/questions/components/table.tsx index d55a7c38..b8a5f027 100644 --- a/app/[locale]/(protected)/supervisor/communications/questions/components/table.tsx +++ b/app/[locale]/(protected)/supervisor/communications/questions/components/table.tsx @@ -107,7 +107,7 @@ const FaqTable = () => { async function fetchData() { try { const res = await getFaqList(); - const contentData = res.data?.data; + const contentData = res?.data?.data; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; }); diff --git a/app/[locale]/(protected)/supervisor/faq/components/table.tsx b/app/[locale]/(protected)/supervisor/faq/components/table.tsx index d55a7c38..b8a5f027 100644 --- a/app/[locale]/(protected)/supervisor/faq/components/table.tsx +++ b/app/[locale]/(protected)/supervisor/faq/components/table.tsx @@ -107,7 +107,7 @@ const FaqTable = () => { async function fetchData() { try { const res = await getFaqList(); - const contentData = res.data?.data; + const contentData = res?.data?.data; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; }); diff --git a/app/[locale]/(protected)/supervisor/ticketing/components/table.tsx b/app/[locale]/(protected)/supervisor/ticketing/components/table.tsx index dd7d93eb..393a26a1 100644 --- a/app/[locale]/(protected)/supervisor/ticketing/components/table.tsx +++ b/app/[locale]/(protected)/supervisor/ticketing/components/table.tsx @@ -108,7 +108,7 @@ const TicketingTable = () => { async function fetchData() { try { const res = await ticketingPagination('', limit, page-1); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/app/[locale]/(public)/content-management/download/page.tsx b/app/[locale]/(public)/content-management/download/page.tsx index 85c96e9f..7b2dd35a 100644 --- a/app/[locale]/(public)/content-management/download/page.tsx +++ b/app/[locale]/(public)/content-management/download/page.tsx @@ -151,12 +151,12 @@ const Galery = (props: any) => { async function checkWishlist(uploadId: any) { if (userId) { const res = await checkWishlistStatus(uploadId); - console.log(res.data?.data); - // const isAlreadyOnWishlist = res.data?.data == "-1" ? false : true; + console.log(res?.data?.data); + // const isAlreadyOnWishlist = res?.data?.data == "-1" ? false : true; // if (isAlreadyOnWishlist == true) { // warning("Konten sudah Ada", `#`); // } - setWishlistId(res.data?.data); // setIsSaved(isAlreadyOnWishlist); + setWishlistId(res?.data?.data); // setIsSaved(isAlreadyOnWishlist); // console.log("isSave", isAlreadyOnWishlist); } } @@ -174,8 +174,8 @@ const Galery = (props: any) => { checkWishlist(uploadId); const res = await saveWishlist(data); - if (res.error) { - error(res.message); + if (res?.error) { + error(res?.message); console.log("simpan data", res); return false; } @@ -188,7 +188,7 @@ const Galery = (props: any) => { loading(); const resDelete = await deleteWishlist(id); - if (resDelete.error) { + if (resDelete?.error) { error(resDelete.message); return false; } diff --git a/app/[locale]/(public)/content-management/galery/page.tsx b/app/[locale]/(public)/content-management/galery/page.tsx index 41acf359..6da4a7e1 100644 --- a/app/[locale]/(public)/content-management/galery/page.tsx +++ b/app/[locale]/(public)/content-management/galery/page.tsx @@ -151,12 +151,12 @@ const Galery = (props: any) => { async function checkWishlist(uploadId: any) { if (userId) { const res = await checkWishlistStatus(uploadId); - console.log(res.data?.data); - // const isAlreadyOnWishlist = res.data?.data == "-1" ? false : true; + console.log(res?.data?.data); + // const isAlreadyOnWishlist = res?.data?.data == "-1" ? false : true; // if (isAlreadyOnWishlist == true) { // warning("Konten sudah Ada", `#`); // } - setWishlistId(res.data?.data); // setIsSaved(isAlreadyOnWishlist); + setWishlistId(res?.data?.data); // setIsSaved(isAlreadyOnWishlist); // console.log("isSave", isAlreadyOnWishlist); } } @@ -174,7 +174,7 @@ const Galery = (props: any) => { checkWishlist(uploadId); const res = await saveWishlist(data); - if (res.error) { + if (res?.error) { error(res.message); console.log("simpan data", res); return false; @@ -188,7 +188,7 @@ const Galery = (props: any) => { loading(); const resDelete = await deleteWishlist(id); - if (resDelete.error) { + if (resDelete?.error) { error(resDelete.message); return false; } diff --git a/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx b/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx index 81a6b5d8..910fa8fe 100644 --- a/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx +++ b/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx @@ -119,7 +119,7 @@ const page = (props: any) => { const res = await generateDataArticle(request); close(); - if (res.error) { + if (res?.error) { console.error(res.message); return false; } diff --git a/app/[locale]/(public)/content-management/rewrite/page.tsx b/app/[locale]/(public)/content-management/rewrite/page.tsx index 3443a381..6ed2e6d8 100644 --- a/app/[locale]/(public)/content-management/rewrite/page.tsx +++ b/app/[locale]/(public)/content-management/rewrite/page.tsx @@ -86,7 +86,7 @@ const page = (props: any) => { loading(); const resDelete = await deleteWishlist(id); - if (resDelete.error) { + if (resDelete?.error) { error(resDelete.message); return false; } @@ -120,12 +120,12 @@ const page = (props: any) => { async function checkWishlist(uploadId: any) { if (userId) { const res = await checkWishlistStatus(uploadId); - console.log(res.data?.data); - // const isAlreadyOnWishlist = res.data?.data == "-1" ? false : true; + console.log(res?.data?.data); + // const isAlreadyOnWishlist = res?.data?.data == "-1" ? false : true; // if (isAlreadyOnWishlist == true) { // warning("Konten sudah Ada", `#`); // } - setWishlistId(res.data?.data); // setIsSaved(isAlreadyOnWishlist); + setWishlistId(res?.data?.data); // setIsSaved(isAlreadyOnWishlist); // console.log("isSave", isAlreadyOnWishlist); } } @@ -143,7 +143,7 @@ const page = (props: any) => { checkWishlist(uploadId); const res = await saveWishlist(data); - if (res.error) { + if (res?.error) { error(res.message); console.log("simpan data", res); return false; diff --git a/app/[locale]/(public)/video/detail/[slug]/page.tsx b/app/[locale]/(public)/video/detail/[slug]/page.tsx index 75c0182d..39c2a507 100644 --- a/app/[locale]/(public)/video/detail/[slug]/page.tsx +++ b/app/[locale]/(public)/video/detail/[slug]/page.tsx @@ -89,9 +89,9 @@ const DetailVideo = () => { async function checkWishlist() { if (userId) { const res = await checkWishlistStatus(slug.split("-")?.[0]); - console.log(res.data?.data); - const isAlreadyOnWishlist = res.data?.data !== "-1"; - setWishlistId(res.data?.data); + console.log(res?.data?.data); + const isAlreadyOnWishlist = res?.data?.data !== "-1"; + setWishlistId(res?.data?.data); setIsSaved(isAlreadyOnWishlist); } } diff --git a/components/form/communication/collaboration-form.tsx b/components/form/communication/collaboration-form.tsx index f7555e3e..e0d49e42 100644 --- a/components/form/communication/collaboration-form.tsx +++ b/components/form/communication/collaboration-form.tsx @@ -121,8 +121,8 @@ export default function FormCollaboration() { async function getTicketPriority() { const res = await getTicketingPriority(); - if (res.data !== null) { - const rawData = res.data?.data; + if (res?.data !== null) { + const rawData = res?.data?.data; setTicketPriority(rawData); } } @@ -130,8 +130,8 @@ export default function FormCollaboration() { async function getUser() { const res = await getCuratorUser(); - if (res.data !== null) { - const rawUser = res.data?.data?.content; + if (res?.data !== null) { + const rawUser = res?.data?.data?.content; console.log("raw user", rawUser); // Tentukan tipe array sebagai Option[] diff --git a/components/form/communication/escalation-detail-form.tsx b/components/form/communication/escalation-detail-form.tsx index 0332f690..5d27b066 100644 --- a/components/form/communication/escalation-detail-form.tsx +++ b/components/form/communication/escalation-detail-form.tsx @@ -107,8 +107,8 @@ export default function FormDetailEscalation() { async function getTicketReply() { const res = await getTicketingInternalDiscussion(id); - if (res.data !== null) { - setTicketReply(res.data?.data); + if (res?.data !== null) { + setTicketReply(res?.data?.data); } } diff --git a/components/form/communication/internal-detail-form.tsx b/components/form/communication/internal-detail-form.tsx index 70a3139e..2e061216 100644 --- a/components/form/communication/internal-detail-form.tsx +++ b/components/form/communication/internal-detail-form.tsx @@ -103,8 +103,8 @@ export default function FormDetailInternal() { async function getTicketReply() { const res = await getTicketingInternalDiscussion(id); - if (res.data !== null) { - setTicketReply(res.data?.data); + if (res?.data !== null) { + setTicketReply(res?.data?.data); } } diff --git a/components/form/communication/internal-edit-form.tsx b/components/form/communication/internal-edit-form.tsx index 3ce6ae44..ee6f183c 100644 --- a/components/form/communication/internal-edit-form.tsx +++ b/components/form/communication/internal-edit-form.tsx @@ -106,8 +106,8 @@ export default function FormEditInternal() { async function getTicketReply() { const res = await getTicketingInternalDiscussion(id); - if (res.data !== null) { - setTicketReply(res.data?.data); + if (res?.data !== null) { + setTicketReply(res?.data?.data); } } diff --git a/components/form/communication/internal-form.tsx b/components/form/communication/internal-form.tsx index b410dcef..613d5bf8 100644 --- a/components/form/communication/internal-form.tsx +++ b/components/form/communication/internal-form.tsx @@ -121,8 +121,8 @@ export default function FormInternal() { async function getTicketPriority() { const res = await getTicketingPriority(); - if (res.data !== null) { - const rawData = res.data?.data; + if (res?.data !== null) { + const rawData = res?.data?.data; setTicketPriority(rawData); } } @@ -130,8 +130,8 @@ export default function FormInternal() { async function getUser() { const res = await getCuratorUser(); - if (res.data !== null) { - const rawUser = res.data?.data?.content; + if (res?.data !== null) { + const rawUser = res?.data?.data?.content; console.log("raw user", rawUser); // Tentukan tipe array sebagai Option[] diff --git a/components/form/content/audio-form.tsx b/components/form/content/audio-form.tsx index 02540647..c9f64e30 100644 --- a/components/form/content/audio-form.tsx +++ b/components/form/content/audio-form.tsx @@ -259,7 +259,7 @@ export default function FormAudio() { const res = await generateDataArticle(request); close(); - if (res.error) { + if (res?.error) { console.error(res.message); return false; } diff --git a/components/form/content/image-ai-form.tsx b/components/form/content/image-ai-form.tsx index cbfc7eb2..907c7704 100644 --- a/components/form/content/image-ai-form.tsx +++ b/components/form/content/image-ai-form.tsx @@ -235,7 +235,7 @@ export default function FormImageAI() { const res = await generateDataArticle(request); close(); - if (res.error) { + if (res?.error) { console.error(res.message); return false; } diff --git a/components/form/content/image-form.tsx b/components/form/content/image-form.tsx index ba970b1e..09fabe3b 100644 --- a/components/form/content/image-form.tsx +++ b/components/form/content/image-form.tsx @@ -286,7 +286,7 @@ export default function FormImage() { const res = await generateDataArticle(request); close(); - if (res.error) { + if (res?.error) { console.error(res.message); return false; } diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index f8e571b9..4529948d 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -321,7 +321,7 @@ export default function FormConvertSPIT() { const res = await generateDataArticle(request); close(); - if (res.error) { + if (res?.error) { console.error(res.message); return false; } diff --git a/components/form/content/teks-form.tsx b/components/form/content/teks-form.tsx index c6da3c7f..e19d7851 100644 --- a/components/form/content/teks-form.tsx +++ b/components/form/content/teks-form.tsx @@ -259,7 +259,7 @@ export default function FormTeks() { const res = await generateDataArticle(request); close(); - if (res.error) { + if (res?.error) { console.error(res.message); return false; } diff --git a/components/form/content/video-form.tsx b/components/form/content/video-form.tsx index 5d1331ef..6441d06e 100644 --- a/components/form/content/video-form.tsx +++ b/components/form/content/video-form.tsx @@ -259,7 +259,7 @@ export default function FormVideo() { const res = await generateDataArticle(request); close(); - if (res.error) { + if (res?.error) { console.error(res.message); return false; } diff --git a/components/landing-page/header-banner-satker.tsx b/components/landing-page/header-banner-satker.tsx index d0a3ba7c..c98233d3 100644 --- a/components/landing-page/header-banner-satker.tsx +++ b/components/landing-page/header-banner-satker.tsx @@ -21,7 +21,7 @@ const HeaderBannerSatker = () => { useEffect(() => { // async function initState() { // const res = await listCarousel(); - // setContent(res.data?.data); + // setContent(res?.data?.data); // setCenterPadding(`${Math.trunc(Number(window.innerWidth) / 10 + 40)}px`); // } diff --git a/components/landing-page/header-banner.tsx b/components/landing-page/header-banner.tsx index df0696b7..41f34191 100644 --- a/components/landing-page/header-banner.tsx +++ b/components/landing-page/header-banner.tsx @@ -21,7 +21,7 @@ const HeaderBanner = () => { useEffect(() => { // async function initState() { // const res = await listCarousel(); - // setContent(res.data?.data); + // setContent(res?.data?.data); // setCenterPadding(`${Math.trunc(Number(window.innerWidth) / 10 + 40)}px`); // } diff --git a/components/table/task-plan/list-view-social-media-table.tsx b/components/table/task-plan/list-view-social-media-table.tsx index 2de87113..30dedc18 100644 --- a/components/table/task-plan/list-view-social-media-table.tsx +++ b/components/table/task-plan/list-view-social-media-table.tsx @@ -108,7 +108,7 @@ const ListViewSocialMediaTable = () => { async function fetchData() { try { const res = await getPlanningPagination(page - 1, "", 10, 2, 3); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/components/table/task-plan/list-view-table.tsx b/components/table/task-plan/list-view-table.tsx index 598b19d4..7aaf38da 100644 --- a/components/table/task-plan/list-view-table.tsx +++ b/components/table/task-plan/list-view-table.tsx @@ -108,7 +108,7 @@ const ListViewTable = () => { async function fetchData() { try { const res = await getPlanningPagination(page - 1, "", 10, 1, 3); - const data = res.data?.data; + const data = res?.data?.data; const contentData = data?.content; contentData.forEach((item: any, index: number) => { item.no = (page - 1) * limit + index + 1; diff --git a/components/table/task-plan/single-view-social-media-table.tsx b/components/table/task-plan/single-view-social-media-table.tsx index 392856ed..825c026f 100644 --- a/components/table/task-plan/single-view-social-media-table.tsx +++ b/components/table/task-plan/single-view-social-media-table.tsx @@ -118,7 +118,7 @@ export default function SingleViewSocialMediaTable() { async function getMonthlyPlanning(dates: number) { const res = await getMonthlyPlanList(dates, 2); - setMonthlyList(res.data?.data); + setMonthlyList(res?.data?.data); } async function getWeeklyPlanning( @@ -127,10 +127,10 @@ export default function SingleViewSocialMediaTable() { ) { if (id) { const res = await getWeeklyPlanListByParentId(id, 2); - setWeeklyList(res.data?.data); + setWeeklyList(res?.data?.data); } else { const res = await getWeeklyPlanList(date, 2, true); - setWeeklyList(res.data?.data); + setWeeklyList(res?.data?.data); } } @@ -230,7 +230,7 @@ export default function SingleViewSocialMediaTable() { loading(); const res = await getPlanningMonthlyPerSocmed(month, year, 2, parentId); close(); - setPlanningData(res.data?.data); + setPlanningData(res?.data?.data); } function getPrevMonth() { diff --git a/components/table/task-plan/single-view-table.tsx b/components/table/task-plan/single-view-table.tsx index 9ebd6b82..30753141 100644 --- a/components/table/task-plan/single-view-table.tsx +++ b/components/table/task-plan/single-view-table.tsx @@ -92,7 +92,7 @@ export default function SingleViewTable() { async function getMonthlyPlanning(dates: number) { const res = await getMonthlyPlanList(dates, 1); console.log("monthsss", res); - setMonthlyList(res.data?.data); + setMonthlyList(res?.data?.data); } async function getWeeklyPlanning( @@ -101,10 +101,10 @@ export default function SingleViewTable() { ) { if (id) { const res = await getWeeklyPlanListByParentId(id, 1); - setWeeklyList(res.data?.data); + setWeeklyList(res?.data?.data); } else { const res = await getWeeklyPlanList(date, 1, true); - setWeeklyList(res.data?.data); + setWeeklyList(res?.data?.data); } } diff --git a/service/http-config/axios-interceptor-instance.ts b/service/http-config/axios-interceptor-instance.ts index 1c360122..bbbe39c6 100644 --- a/service/http-config/axios-interceptor-instance.ts +++ b/service/http-config/axios-interceptor-instance.ts @@ -45,8 +45,8 @@ axiosInterceptorInstance.interceptors.response.use( }; console.log("refresh token ", data); const res = await login(data); - const { access_token } = res.data; - const { refresh_token } = res.data; + const { access_token } = res?.data; + const { refresh_token } = res?.data; if (access_token) { Cookies.set("access_token", access_token); Cookies.set("refresh_token", refresh_token);