# feat
## Deskripsi: - Edit map - Sinkronisasi dengan data portofolio ### No Issue
This commit is contained in:
@@ -2,15 +2,12 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function auth_funEditAktivasiKodeOtpById(otpId: string) {
|
||||
export async function auth_funDeleteAktivasiKodeOtpById(otpId: string) {
|
||||
// console.log(otpId);
|
||||
const updt = await prisma.kodeOtp.update({
|
||||
const updt = await prisma.kodeOtp.delete({
|
||||
where: {
|
||||
id: otpId,
|
||||
},
|
||||
data: {
|
||||
isActive: false,
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update Aktivasi Kode OTP" };
|
||||
|
||||
@@ -9,7 +9,10 @@ export async function auth_funLogin(nomor: string) {
|
||||
|
||||
try {
|
||||
const res = await fetch(
|
||||
`https://wa.wibudev.com/code?nom=${nomor}&text=HIPMI - Masukan kode OTP sesuai dengan nomor yang anda daftarkan, kode ini bersifat rahasia & jangan di bagikan pada siapapun termasuk anggota ataupun pengurus HIPMI lainnya. Kode OTP anda: ${codeOtp}`
|
||||
`https://wa.wibudev.com/code?nom=${nomor}&text=HIPMI - Kode ini bersifat RAHASIA dan JANGAN DI BAGIKAN KEPADA SIAPAPUN, termasuk anggota ataupun pengurus HIPMI lainnya.
|
||||
\n
|
||||
>> Kode OTP anda: ${codeOtp}.
|
||||
`
|
||||
);
|
||||
|
||||
const sendWa = await res.json();
|
||||
@@ -31,6 +34,7 @@ export async function auth_funLogin(nomor: string) {
|
||||
kodeOtpId: createOtpId.id,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return { status: 500, message: "Server Error !!!" };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,12 @@ export async function auth_Logout(kodeId: string) {
|
||||
const c = cookies().get("ssn");
|
||||
if (c?.value !== "") return { status: 400, message: "Gagal Logout" };
|
||||
|
||||
const del = await prisma.kodeOtp.delete({
|
||||
where: {
|
||||
id: kodeId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!del) return { status: 400, message: "Gagal Hapus Kode OTP Id"};
|
||||
// const del = await prisma.kodeOtp.delete({
|
||||
// where: {
|
||||
// id: kodeId,
|
||||
// },
|
||||
// });
|
||||
// if (!del) return { status: 400, message: "Gagal Hapus Kode OTP Id"};
|
||||
// revalidatePath("/dev/katalog")
|
||||
return { status: 200, message: "Logout Berhasil" };
|
||||
}
|
||||
|
||||
@@ -9,5 +9,5 @@ export async function auth_getKodeOtpById(otpId: string) {
|
||||
},
|
||||
});
|
||||
|
||||
return data
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -1,35 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
BackgroundImage,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useFocusTrap } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_kodeId } from "../state/state";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { auth_funLogin } from "@/app_modules/auth/fun/fun_login";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { PhoneInput } from "react-international-phone";
|
||||
import "react-international-phone/style.css";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { auth_funLogin } from "@/app_modules/auth/fun/fun_login";
|
||||
import {
|
||||
BackgroundImage,
|
||||
Button,
|
||||
Center,
|
||||
Stack,
|
||||
Text,
|
||||
Title
|
||||
} from "@mantine/core";
|
||||
import { useFocusTrap } from "@mantine/hooks";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { PhoneInput } from "react-international-phone";
|
||||
import "react-international-phone/style.css";
|
||||
import { gs_kodeId } from "../state/state";
|
||||
|
||||
export default function Login() {
|
||||
const router = useRouter();
|
||||
|
||||
@@ -1,26 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Group,
|
||||
Modal,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
Text
|
||||
} from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_kodeId, gs_nomor, gs_otp } from "../state/state";
|
||||
import { IconLogout } from "@tabler/icons-react";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { auth_Logout } from "../fun/fun_logout";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import { auth_Logout } from "../fun/fun_logout";
|
||||
import { gs_kodeId } from "../state/state";
|
||||
|
||||
export default function Component_Logout() {
|
||||
const router = useRouter();
|
||||
|
||||
@@ -1,42 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import {
|
||||
Flex,
|
||||
Title,
|
||||
TextInput,
|
||||
Button,
|
||||
Text,
|
||||
Center,
|
||||
PinInput,
|
||||
Stack,
|
||||
BackgroundImage,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconCircleLetterH,
|
||||
IconCloudLockOpen,
|
||||
IconUserCircle,
|
||||
} from "@tabler/icons-react";
|
||||
import { gs_nomor } from "../state/state";
|
||||
import { useAtom } from "jotai";
|
||||
import { useState } from "react";
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import toast from "react-simple-toasts";
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { useRouter } from "next/navigation";
|
||||
import _ from "lodash";
|
||||
import { useFocusTrap } from "@mantine/hooks";
|
||||
import { Auth_funRegister } from "../fun/fun_register";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { IconPencilCheck } from "@tabler/icons-react";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
} from "@/app_modules/_global/color/color_pallet";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import {
|
||||
BackgroundImage,
|
||||
Button,
|
||||
Center,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title
|
||||
} from "@mantine/core";
|
||||
import { useFocusTrap } from "@mantine/hooks";
|
||||
import {
|
||||
IconUserCircle
|
||||
} from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { auth_funDeleteAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import { Auth_funRegister } from "../fun/fun_register";
|
||||
|
||||
export default function Register({ dataOtp }: { dataOtp: any }) {
|
||||
const router = useRouter();
|
||||
@@ -60,21 +49,20 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
|
||||
if (body.username.length < 5) return null;
|
||||
if (_.values(body.username).includes(" ")) return null;
|
||||
|
||||
await Auth_funRegister(body).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
await auth_funEditAktivasiKodeOtpById(dataOtp.id).then((val) => {
|
||||
if (val.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoading(true);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(val.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
});
|
||||
const res = await Auth_funRegister(body)
|
||||
if (res.status === 200) {
|
||||
await auth_funDeleteAktivasiKodeOtpById(dataOtp.id).then((val) => {
|
||||
if (val.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoading(true);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(val.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -24,7 +24,7 @@ import { useFocusTrap } from "@mantine/hooks";
|
||||
import { IconChevronLeft } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import { auth_funDeleteAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import { auth_funValidasi } from "../fun/fun_validasi";
|
||||
|
||||
export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
@@ -41,26 +41,26 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
if (code != inputCode)
|
||||
return ComponentGlobal_NotifikasiPeringatan("Kode Salah");
|
||||
|
||||
await auth_funValidasi(nomor).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
await auth_funEditAktivasiKodeOtpById(dataOtp.id).then((val) => {
|
||||
if (val.status === 200) {
|
||||
if (res.role === "1") {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoading(true);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
router.push(RouterAdminDashboard.splash_admin);
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(val.message);
|
||||
}
|
||||
});
|
||||
const res = await auth_funValidasi(nomor);
|
||||
if (res.status === 200) {
|
||||
|
||||
const resAktivasi = await auth_funDeleteAktivasiKodeOtpById(dataOtp.id);
|
||||
if (resAktivasi.status === 200) {
|
||||
if (res.role === "1") {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setLoading(true);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
router.push(RouterAdminDashboard.splash_admin);
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterAuth.register + dataOtp.id);
|
||||
ComponentGlobal_NotifikasiPeringatan(resAktivasi.message);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterAuth.register + dataOtp.id, { scroll: false });
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user