From 7c04d851343a78b1a0f289e1561b861db9ac4d3a Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Wed, 5 Feb 2025 10:35:33 +0800 Subject: [PATCH] fix API deskripsi: - api login , validasi, hapus code otp --- ...2026a78b8cb786880c7c733460d7dbe-audit.json | 15 +- ...c6075347623def466341a14f8ba4a12-audit.json | 15 +- logs/backend/combined-2025-01-21.log | 4 - logs/backend/combined-2025-01-22.log | 3 - logs/backend/combined-2025-02-04.log | 1 + logs/backend/combined-2025-02-05.log | 1 + logs/backend/error-2025-01-21.log | 0 logs/backend/error-2025-01-22.log | 3 - logs/backend/error-2025-02-04.log | 1 + logs/backend/error-2025-02-05.log | 1 + src/app/api/auth/check/[id]/route.ts | 30 ++ src/app/api/auth/check/route.ts | 24 -- src/app/api/auth/code/route.ts | 67 ++++ src/app/api/auth/validasi/route.ts | 98 +++--- src/app_modules/auth/_lib/api_fetch_auth.ts | 37 ++- src/app_modules/auth/register/view.tsx | 134 ++++---- src/app_modules/auth/validasi/view.tsx | 285 ++++++++++-------- .../component/detail/comp_box_sponsor.tsx | 23 +- 18 files changed, 442 insertions(+), 300 deletions(-) delete mode 100644 logs/backend/combined-2025-01-21.log delete mode 100644 logs/backend/combined-2025-01-22.log create mode 100644 logs/backend/combined-2025-02-05.log delete mode 100644 logs/backend/error-2025-01-21.log delete mode 100644 logs/backend/error-2025-01-22.log create mode 100644 logs/backend/error-2025-02-05.log create mode 100644 src/app/api/auth/check/[id]/route.ts delete mode 100644 src/app/api/auth/check/route.ts create mode 100644 src/app/api/auth/code/route.ts diff --git a/logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json b/logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json index 66eedd43..7f265053 100644 --- a/logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json +++ b/logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json @@ -5,16 +5,6 @@ }, "auditLog": "logs/backend/.31d2357fa2026a78b8cb786880c7c733460d7dbe-audit.json", "files": [ - { - "date": 1737425815219, - "name": "logs/backend/combined-2025-01-21.log", - "hash": "b9cbc8d149568aaeb134725613e3cbf7e862bfe2acb7e6db56292abbf79e51a1" - }, - { - "date": 1737497241982, - "name": "logs/backend/combined-2025-01-22.log", - "hash": "574f8bfec27f059626b3174fe1911a733e84d38ac91be87f853456aae15b11a7" - }, { "date": 1737685849478, "name": "logs/backend/combined-2025-01-24.log", @@ -59,6 +49,11 @@ "date": 1738635038169, "name": "logs/backend/combined-2025-02-04.log", "hash": "b197eb2d58bbab3566e05fdb2bcc52ee608c4fe6ffb54fc958060c8dc4ff305f" + }, + { + "date": 1738709515069, + "name": "logs/backend/combined-2025-02-05.log", + "hash": "04d27d0d5708dfb4655dbb708eb49f663c063c8f571ea5aa4da9e5bee9daa0f3" } ], "hashType": "sha256" diff --git a/logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json b/logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json index 07566270..2ffc44e0 100644 --- a/logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json +++ b/logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json @@ -5,16 +5,6 @@ }, "auditLog": "logs/backend/.5d9a990e0c6075347623def466341a14f8ba4a12-audit.json", "files": [ - { - "date": 1737425815214, - "name": "logs/backend/error-2025-01-21.log", - "hash": "d35389a53138894117f18cdd8210378c4ccfeea9921a52e42837102cad72c108" - }, - { - "date": 1737497241981, - "name": "logs/backend/error-2025-01-22.log", - "hash": "cb0bde065d94357687bece5102573a1876e3f00e1513ff9189e07f56cdadb82e" - }, { "date": 1737685849475, "name": "logs/backend/error-2025-01-24.log", @@ -59,6 +49,11 @@ "date": 1738635038164, "name": "logs/backend/error-2025-02-04.log", "hash": "7490b9f6c36fa2500bafa66c4aa590053c50234150ad9ad86ad9400f0ba76a43" + }, + { + "date": 1738709515065, + "name": "logs/backend/error-2025-02-05.log", + "hash": "b76580b2a8b76ee8941e0d913ff1b38d66ad7bd45f154ed371c913ff898e5dfd" } ], "hashType": "sha256" diff --git a/logs/backend/combined-2025-01-21.log b/logs/backend/combined-2025-01-21.log deleted file mode 100644 index f8447571..00000000 --- a/logs/backend/combined-2025-01-21.log +++ /dev/null @@ -1,4 +0,0 @@ -{"level":"info","message":"Server status code: 201","timestamp":"2025-01-21T05:44:04.245Z"} -{"level":"info","message":"Success upload donasi_bukti_transfer: {\"id\":\"cm661vcrb002a7r93gbyi7y0g\",\"name\":\"56FE8EB6-BB7C-45BF-8879-A3EB7C59CA58.PNG\",\"path\":\"/cm0ur1yxw000056nsjlr6187p/2025/01/21/56FE8EB6-BB7C-45BF-8879-A3EB7C59CA58.PNG\",\"mime\":\"image/png\",\"ext\":\".PNG\",\"desc\":null,\"size\":2531618,\"active\":true,\"createdAt\":\"2025-01-21T05:44:03.670Z\",\"updatedAt\":\"2025-01-21T05:44:03.671Z\",\"userId\":\"cm0ur1yxw000056nsjlr6187p\",\"dirId\":\"cm0yk1pmh000h10njhi6m8b8t\"}","timestamp":"2025-01-21T05:44:04.331Z"} -{"level":"info","message":"Server status code: 201","timestamp":"2025-01-21T05:53:55.644Z"} -{"level":"info","message":"Success upload event_sponsor: {\"id\":\"cm66281fn001rc9dcdf7m74ji\",\"name\":\"56FE8EB6-BB7C-45BF-8879-A3EB7C59CA58-1.PNG\",\"path\":\"/cm0ur1yxw000056nsjlr6187p/2025/01/21/56FE8EB6-BB7C-45BF-8879-A3EB7C59CA58-1.PNG\",\"mime\":\"image/png\",\"ext\":\".PNG\",\"desc\":null,\"size\":2531618,\"active\":true,\"createdAt\":\"2025-01-21T05:53:55.522Z\",\"updatedAt\":\"2025-01-21T05:53:55.523Z\",\"userId\":\"cm0ur1yxw000056nsjlr6187p\",\"dirId\":\"cm65zlbyf001udvmggnd6i0oh\"}","timestamp":"2025-01-21T05:53:55.647Z"} diff --git a/logs/backend/combined-2025-01-22.log b/logs/backend/combined-2025-01-22.log deleted file mode 100644 index 538b3c85..00000000 --- a/logs/backend/combined-2025-01-22.log +++ /dev/null @@ -1,3 +0,0 @@ -{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-01-21T22:11:48.296Z"} -{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-01-21T22:24:18.884Z"} -{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-01-21T22:31:50.770Z"} diff --git a/logs/backend/combined-2025-02-04.log b/logs/backend/combined-2025-02-04.log index 95b71089..aacd117d 100644 --- a/logs/backend/combined-2025-02-04.log +++ b/logs/backend/combined-2025-02-04.log @@ -1 +1,2 @@ {"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-04T03:16:37.809Z"} +{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-04T06:54:35.085Z"} diff --git a/logs/backend/combined-2025-02-05.log b/logs/backend/combined-2025-02-05.log new file mode 100644 index 00000000..85961909 --- /dev/null +++ b/logs/backend/combined-2025-02-05.log @@ -0,0 +1 @@ +{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T02:30:14.963Z"} diff --git a/logs/backend/error-2025-01-21.log b/logs/backend/error-2025-01-21.log deleted file mode 100644 index e69de29b..00000000 diff --git a/logs/backend/error-2025-01-22.log b/logs/backend/error-2025-01-22.log deleted file mode 100644 index 538b3c85..00000000 --- a/logs/backend/error-2025-01-22.log +++ /dev/null @@ -1,3 +0,0 @@ -{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-01-21T22:11:48.296Z"} -{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-01-21T22:24:18.884Z"} -{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-01-21T22:31:50.770Z"} diff --git a/logs/backend/error-2025-02-04.log b/logs/backend/error-2025-02-04.log index 95b71089..aacd117d 100644 --- a/logs/backend/error-2025-02-04.log +++ b/logs/backend/error-2025-02-04.log @@ -1 +1,2 @@ {"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-04T03:16:37.809Z"} +{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-04T06:54:35.085Z"} diff --git a/logs/backend/error-2025-02-05.log b/logs/backend/error-2025-02-05.log new file mode 100644 index 00000000..85961909 --- /dev/null +++ b/logs/backend/error-2025-02-05.log @@ -0,0 +1 @@ +{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T02:30:14.963Z"} diff --git a/src/app/api/auth/check/[id]/route.ts b/src/app/api/auth/check/[id]/route.ts new file mode 100644 index 00000000..4e073fb5 --- /dev/null +++ b/src/app/api/auth/check/[id]/route.ts @@ -0,0 +1,30 @@ +import { prisma } from "@/app/lib"; +import backendLogger from "@/util/backendLogger"; +import { NextRequest, NextResponse } from "next/server"; +export const dynamic = "force-dynamic"; + +export async function GET( + request: Request, + { params }: { params: { id: string } } +) { + if (request.method !== "GET") { + return NextResponse.json( + { success: false, message: "Method not allowed" }, + { status: 405 } + ); + } + + try { + const { id } = params; + const data = await prisma.kodeOtp.findFirst({ + where: { + id: id as string, + }, + }); + + return NextResponse.json(data, { status: 200 }); + } catch (error) { + backendLogger.error("Error get code otp", error); //(error); + return NextResponse.json(null, { status: 500 }); + } +} diff --git a/src/app/api/auth/check/route.ts b/src/app/api/auth/check/route.ts deleted file mode 100644 index b51a6f31..00000000 --- a/src/app/api/auth/check/route.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { prisma } from "@/app/lib"; -import { data } from "autoprefixer"; -import { NextRequest, NextResponse } from "next/server"; -export const dynamic = "force-dynamic"; - -export async function GET(request: NextRequest) { - const id = request.nextUrl.searchParams.get("id"); - // const { searchParams } = new URL(request.url); - // const id = searchParams.get("id"); - - try { - const data = await prisma.kodeOtp.findFirst({ - where: { - id: id as string, - }, - }); - - return NextResponse.json(data, { status: 200 }); - } catch (error) { - console.log(error); - } - - return NextResponse.json(null, { status: 500 }); -} diff --git a/src/app/api/auth/code/route.ts b/src/app/api/auth/code/route.ts new file mode 100644 index 00000000..9ecd35de --- /dev/null +++ b/src/app/api/auth/code/route.ts @@ -0,0 +1,67 @@ +import { prisma } from "@/app/lib"; +import { NextResponse } from "next/server"; + +export { DELETE }; +async function DELETE(request: Request) { + if (request.method !== "DELETE") { + return NextResponse.json( + { success: false, message: "Method not allowed" }, + { status: 405 } + ); + } + try { + // Ambil parameter nomor dari URL + const { searchParams } = new URL(request.url); + const nomor = searchParams.get("nomor"); + + // Validasi parameter nomor + if (!nomor) { + return NextResponse.json( + { + success: false, + message: "Parameter 'nomor' diperlukan", + }, + { status: 400 } + ); + } + + // Cek apakah data OTP dengan nomor tersebut ada + const existingOtp = await prisma.kodeOtp.findFirst({ + where: { nomor }, + }); + + if (!existingOtp) { + return NextResponse.json( + { + success: false, + message: "Data OTP tidak ditemukan", + }, + { status: 404 } + ); + } + + // Hapus data OTP + await prisma.kodeOtp.deleteMany({ + where: { nomor }, + }); + + return NextResponse.json( + { + success: true, + message: "Berhasil menghapus data OTP", + }, + { status: 200 } + ); + } catch (error) { + console.error("Error deleting OTP:", error); + return NextResponse.json( + { + success: false, + message: "Terjadi kesalahan saat menghapus data OTP", + }, + { status: 500 } + ); + } finally { + await prisma.$disconnect(); + } +} diff --git a/src/app/api/auth/validasi/route.ts b/src/app/api/auth/validasi/route.ts index c8c2e9ea..c13633fd 100644 --- a/src/app/api/auth/validasi/route.ts +++ b/src/app/api/auth/validasi/route.ts @@ -4,58 +4,60 @@ import backendLogger from "@/util/backendLogger"; import { NextResponse } from "next/server"; export async function POST(req: Request) { - if (req.method === "POST") { + if (req.method !== "POST") { + return NextResponse.json( + { success: false, message: "Method Not Allowed" }, + { status: 405 } + ); + } + + try { const { nomor } = await req.json(); + const dataUser = await prisma.user.findUnique({ + where: { + nomor: nomor, + }, + select: { + id: true, + nomor: true, + username: true, + active: true, + masterUserRoleId: true, + }, + }); - try { - const dataUser = await prisma.user.findUnique({ - where: { - nomor: nomor, - }, - select: { - id: true, - nomor: true, - username: true, - active: true, - masterUserRoleId: true, - }, - }); - - if (dataUser == null) - return NextResponse.json( - { success: false, message: "Nomor Belum Terdaftar" }, - { status: 404 } - ); - - const token = await sessionCreate({ - sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!, - encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!, - user: dataUser as any, - }); - + if (dataUser == null) return NextResponse.json( - { - success: true, - message: "Berhasil Login", - roleId: dataUser.masterUserRoleId, - active: dataUser.active, - }, + { success: false, message: "Nomor Belum Terdaftar" }, { status: 200 } ); - } catch (error) { - backendLogger.log("Error Validasi:", error); - return NextResponse.json( - { - success: false, - message: "Server Error", - reason: (error as Error).message, - }, - { status: 500 } - ); - } + + const token = await sessionCreate({ + sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!, + encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!, + user: dataUser as any, + }); + + return NextResponse.json( + { + success: true, + message: "Berhasil Login", + roleId: dataUser.masterUserRoleId, + active: dataUser.active, + }, + { status: 200 } + ); + } catch (error) { + backendLogger.log("API Error or Server Error", error); + return NextResponse.json( + { + success: false, + message: "API Error or Server Error", + reason: (error as Error).message, + }, + { status: 500 } + ); + } finally { + await prisma.$disconnect(); } - return NextResponse.json( - { success: false, message: "Method Not Allowed" }, - { status: 405 } - ); } diff --git a/src/app_modules/auth/_lib/api_fetch_auth.ts b/src/app_modules/auth/_lib/api_fetch_auth.ts index 15882c76..ed7d9bc1 100644 --- a/src/app_modules/auth/_lib/api_fetch_auth.ts +++ b/src/app_modules/auth/_lib/api_fetch_auth.ts @@ -1,4 +1,9 @@ -export { apiFetchLogin }; +export { + apiFetchLogin, + apiGetCheckCodeOtp, + apiPostVerifikasiCodeOtp, + apiDeleteAktivasiKodeOtpByNomor, +}; const apiFetchLogin = async ({ nomor }: { nomor: string }) => { const respone = await fetch("/api/auth/login", { @@ -11,3 +16,33 @@ const apiFetchLogin = async ({ nomor }: { nomor: string }) => { return await respone.json().catch(() => null); }; + +const apiGetCheckCodeOtp = async ({ id }: { id: string }) => { + const respone = await fetch(`/api/auth/check/${id}`); + + return await respone.json().catch(() => null); +}; + +const apiPostVerifikasiCodeOtp = async ({ nomor }: { nomor: string }) => { + const respone = await fetch("/api/auth/validasi", { + method: "POST", + body: JSON.stringify({ nomor: nomor }), + headers: { + "Content-Type": "application/json", + }, + }); + + return await respone.json().catch(() => null); +}; + +const apiDeleteAktivasiKodeOtpByNomor = async ({ + nomor, +}: { + nomor: string; +}) => { + const respone = await fetch(`/api/auth/delete/${nomor}`, { + method: "DELETE", + }); + + return await respone.json().catch(() => null); +}; diff --git a/src/app_modules/auth/register/view.tsx b/src/app_modules/auth/register/view.tsx index 37276b59..0aab82e8 100644 --- a/src/app_modules/auth/register/view.tsx +++ b/src/app_modules/auth/register/view.tsx @@ -5,7 +5,7 @@ import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_in import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; import { UIGlobal_LayoutDefault } from "@/app_modules/_global/ui"; -import { Button, Stack, Text, TextInput, Title } from "@mantine/core"; +import { Button, Center, Stack, Text, TextInput, Title } from "@mantine/core"; import { useFocusTrap, useShallowEffect } from "@mantine/hooks"; import { IconUserCircle } from "@tabler/icons-react"; import _ from "lodash"; @@ -14,6 +14,8 @@ import { useState } from "react"; import { auth_funDeleteAktivasiKodeOtpByNomor } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; import Register_SkeletonView from "./skeleton"; import { clientLogger } from "@/util/clientLogger"; +import { apiGetCheckCodeOtp } from "../_lib/api_fetch_auth"; +import CustomSkeleton from "@/app_modules/components/CustomSkeleton"; export default function Register() { const router = useRouter(); @@ -39,10 +41,16 @@ export default function Register() { kodeId: string; onSetData: any; }) { - const res = await fetch(`/api/auth/check?id=${kodeId}`); - const result = await res.json(); - - onSetData(result.nomor); + try { + const respone = await apiGetCheckCodeOtp({ id: kodeId }); + if (respone) { + onSetData(respone.nomor); + } + } catch (error) { + clientLogger.error("Error onCheckAuthCode:", error); + } + // const res = await fetch(`/api/auth/check?id=${kodeId}`); + // const result = await res.json(); } async function onRegistarsi() { @@ -102,71 +110,75 @@ export default function Register() { return ( <> - {nomor == "" ? ( - - ) : ( - - - REGISTRASI - + + + REGISTRASI + - + - + + - Anda akan terdaftar dengan nomor berikut{" "} - + Anda akan terdaftar dengan nomor + + {nomor == "" ? ( +
+ +
+ ) : ( + +{nomor} -
- 0 && value.length < 5 ? ( - - ) : _.values(value).includes(" ") ? ( - - - - - ) : isValue ? ( - - ) : ( - "" - ) + )} +
+ 0 && value.length < 5 ? ( + + ) : _.values(value).includes(" ") ? ( + + + + + ) : isValue ? ( + + ) : ( + "" + ) + } + onChange={(val) => { + val.currentTarget.value.length > 0 ? setIsValue(false) : ""; + setValue(val.currentTarget.value); + }} + /> + + - + > + DAFTAR +
- )} +
); diff --git a/src/app_modules/auth/validasi/view.tsx b/src/app_modules/auth/validasi/view.tsx index 65b603b9..ff2c31d8 100644 --- a/src/app_modules/auth/validasi/view.tsx +++ b/src/app_modules/auth/validasi/view.tsx @@ -10,8 +10,11 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_ import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; import { UIGlobal_LayoutDefault } from "@/app_modules/_global/ui"; import { + ActionIcon, + Box, Button, Center, + Group, Loader, PinInput, Stack, @@ -26,6 +29,14 @@ import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_glo import { auth_funDeleteAktivasiKodeOtpByNomor } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; import Validasi_SkeletonView from "./skeleton"; import { clientLogger } from "@/util/clientLogger"; +import { IconChevronLeft } from "@tabler/icons-react"; +import _ from "lodash"; +import CustomSkeleton from "@/app_modules/components/CustomSkeleton"; +import { + apiDeleteAktivasiKodeOtpByNomor, + apiGetCheckCodeOtp, + apiPostVerifikasiCodeOtp, +} from "../_lib/api_fetch_auth"; export default function Validasi() { const router = useRouter(); @@ -61,20 +72,24 @@ export default function Validasi() { }, [triggerOtp]); async function onCheckAuthCode({ kodeId }: { kodeId: string }) { - const res = await fetch(`/api/auth/check?id=${kodeId}`); - const result = await res.json(); - - setData({ - nomor: result.nomor, - code: result.otp, - }); + try { + const respone = await apiGetCheckCodeOtp({ id: kodeId }); + if (respone) { + setData({ + nomor: respone.nomor, + code: respone.otp, + }); + } + } catch (error) { + clientLogger.error("Error onCheckAuthCode:", error); + } } useEffect(() => { counter > 0 && setTimeout(() => setCounter(counter - 1), 1000); }, [counter]); - async function onVerifikasi() { + async function onSubmitVerifikasi() { if (!inputCode) return ComponentGlobal_NotifikasiPeringatan("Lengkapi Kode"); if (data.code != inputCode) @@ -82,59 +97,77 @@ export default function Validasi() { try { setLoading(true); - const res = await fetch("/api/auth/validasi", { - method: "POST", - body: JSON.stringify({ - nomor: data.nomor, - }), - }); + const respone = await apiPostVerifikasiCodeOtp({ nomor: data.nomor }); - const result = await res.json(); + if (respone && respone.success == true) { + if (respone.roleId == "1") { + ComponentGlobal_NotifikasiBerhasil(respone.message); + localStorage.removeItem("hipmi_auth_code_id"); - if (res.status === 200 && result.roleId == "1") { - ComponentGlobal_NotifikasiBerhasil(result.message); - localStorage.removeItem("hipmi_auth_code_id"); - await auth_funDeleteAktivasiKodeOtpByNomor({ - nomor: data.nomor, - }); + router.push(RouterHome.main_home, { scroll: false }); + } else if (respone.roleId != "1") { + ComponentGlobal_NotifikasiBerhasil("Admin berhasil login"); + localStorage.removeItem("hipmi_auth_code_id"); - router.push(RouterHome.main_home, { scroll: false }); - return; - } + router.push(RouterAdminDashboard.splash_admin, { scroll: false }); + } - if (res.status === 200 && result.roleId != "1") { - ComponentGlobal_NotifikasiBerhasil("Admin Logged in"); - localStorage.removeItem("hipmi_auth_code_id"); - await auth_funDeleteAktivasiKodeOtpByNomor({ - nomor: data.nomor, - }); - - router.push(RouterAdminDashboard.splash_admin, { scroll: false }); - return; - } - - if (res.status === 404) { - setLoading(false); + try { + const responeDelete = await apiDeleteAktivasiKodeOtpByNomor({ + nomor: data.nomor, + }); + } catch (error) { + clientLogger.error("Error apiDeleteAktivasiKodeOtpByNomor:", error); + } + } else if (respone && respone.success == false) { router.push("/register", { scroll: false }); - ComponentGlobal_NotifikasiBerhasil(result.message); - return; + ComponentGlobal_NotifikasiBerhasil(respone.message); } - if (res.status === 400) { - setLoading(false); - ComponentGlobal_NotifikasiPeringatan(result.message); - return; - } + // if (respone.status === 200 && result.roleId == "1") { + // ComponentGlobal_NotifikasiBerhasil(result.message); + // localStorage.removeItem("hipmi_auth_code_id"); + // await auth_funDeleteAktivasiKodeOtpByNomor({ + // nomor: data.nomor, + // }); - if (res.status == 500) { - setLoading(false); - ComponentGlobal_NotifikasiGagal(result.message); - return; - } + // router.push(RouterHome.main_home, { scroll: false }); + // return; + // } + + // if (respone.status === 200 && result.roleId != "1") { + // ComponentGlobal_NotifikasiBerhasil("Admin Logged in"); + // localStorage.removeItem("hipmi_auth_code_id"); + // await auth_funDeleteAktivasiKodeOtpByNomor({ + // nomor: data.nomor, + // }); + + // router.push(RouterAdminDashboard.splash_admin, { scroll: false }); + // return; + // } + + // if (respone.status === 404) { + // setLoading(false); + // router.push("/register", { scroll: false }); + // ComponentGlobal_NotifikasiBerhasil(result.message); + // return; + // } + + // if (respone.status === 400) { + // setLoading(false); + // ComponentGlobal_NotifikasiPeringatan(result.message); + // return; + // } + + // if (respone.status == 500) { + // setLoading(false); + // ComponentGlobal_NotifikasiGagal(result.message); + // return; + // } } catch (error) { setLoading(false); clientLogger.error("Error validasi:", error); - } + } } async function onBack() { @@ -176,8 +209,6 @@ export default function Validasi() { } } - // console.log(data.code); - return ( <> @@ -194,84 +225,88 @@ export default function Validasi() { */} - {data.nomor == "" && data.code == "" ? ( - - ) : ( - - - Verifikasi Kode OTP - - - - Masukan 4 digit kode otp - - Yang dikirim ke{" "} - - {" "} + + + Verifikasi Kode OTP + + + + + Masukan 4 digit kode otp + + Yang dikirim ke + {data && data.nomor !== "" ? ( + +{data.nomor} - - -
- { - setInputOtp(val); - }} - /> -
- - - - Tidak menerima kode ?{" "} - {counter > 0 ? ( - - {counter + "s"} - - ) : loadingResend ? ( - - ) : ( - { - onResendCode(); - }} - fw={"bold"} - > - Kirim ulang - - )} - - + ) : ( + + )} + +
+
+ { + setInputOtp(val); + }} + /> +
+ + + + Tidak menerima kode ?{" "} + {counter > 0 ? ( + + {counter + "s"} + + ) : loadingResend ? ( + + ) : ( + { + onResendCode(); + }} + fw={"bold"} + > + Kirim ulang + + )} + -
- )} + + + + {/* {data.nomor == "" && data.code == "" ? : ""} */}
diff --git a/src/app_modules/event/component/detail/comp_box_sponsor.tsx b/src/app_modules/event/component/detail/comp_box_sponsor.tsx index 9505d1f6..5777ed70 100644 --- a/src/app_modules/event/component/detail/comp_box_sponsor.tsx +++ b/src/app_modules/event/component/detail/comp_box_sponsor.tsx @@ -1,9 +1,10 @@ -import { RouterEvent } from '@/app/lib/router_hipmi/router_event'; -import { AccentColor, MainColor } from '@/app_modules/_global/color'; -import { ActionIcon, Flex, Loader, Paper, Text } from '@mantine/core'; -import { IconStar } from '@tabler/icons-react'; -import { useParams, useRouter } from 'next/navigation'; -import { useState } from 'react'; +import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; +import { AccentColor, MainColor } from "@/app_modules/_global/color"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; +import { ActionIcon, Flex, Loader, Paper, Text } from "@mantine/core"; +import { IconStar } from "@tabler/icons-react"; +import { useParams, useRouter } from "next/navigation"; +import { useState } from "react"; function Event_ComponentBoxDaftarSponsor() { const router = useRouter(); @@ -20,11 +21,11 @@ function Event_ComponentBoxDaftarSponsor() { color: "white", }} onClick={() => { - setLoading(true); - router.push(RouterEvent.daftar_sponsor({ id: params.id }), { - scroll: false, - }); - // router.push(RouterInvestasi_OLD.detail_dokumen + investasiId, { scroll: false }); + // setLoading(true); + // router.push(RouterEvent.daftar_sponsor({ id: params.id }), { + // scroll: false, + // }); + ComponentGlobal_NotifikasiPeringatan("Fitur belum tersedia"); }} >