test server
This commit is contained in:
@@ -5,6 +5,7 @@ import { randomOTP } from "./rondom_otp";
|
||||
|
||||
export async function auth_funLogin(nomor: string) {
|
||||
const codeOtp = randomOTP();
|
||||
console.log(nomor)
|
||||
|
||||
try {
|
||||
const res = await fetch(
|
||||
|
||||
@@ -21,6 +21,6 @@ export async function auth_Logout(kodeId: string) {
|
||||
});
|
||||
|
||||
if (!del) return { status: 400, message: "Gagal Hapus Kode OTP Id"};
|
||||
revalidatePath("/dev/katalog")
|
||||
// revalidatePath("/dev/katalog")
|
||||
return { status: 200, message: "Logout Berhasil" };
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export async function auth_funValidasi(nomor: string) {
|
||||
id: true,
|
||||
nomor: true,
|
||||
username: true,
|
||||
masterUserRoleId: true
|
||||
},
|
||||
});
|
||||
|
||||
@@ -42,5 +43,7 @@ export async function auth_funValidasi(nomor: string) {
|
||||
revalidatePath(RouterHome.main_home);
|
||||
}
|
||||
|
||||
return { status: 200, message: "Nomor Terverivikasi" };
|
||||
|
||||
|
||||
return { status: 200, message: "Nomor Terverivikasi", role: cek.masterUserRoleId };
|
||||
}
|
||||
|
||||
@@ -39,9 +39,11 @@ export default function Login() {
|
||||
// return ComponentGlobal_NotifikasiPeringatan("Nomor maximal 13 digit");
|
||||
|
||||
const nomorHp = phone.substring(1);
|
||||
// console.log(nomorHp)
|
||||
|
||||
await auth_funLogin(nomorHp).then((res) => {
|
||||
if (res.status === 200) {
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
setKodeId(res.kodeOtpId);
|
||||
router.push(RouterAuth.validasi + res.kodeOtpId);
|
||||
@@ -130,7 +132,6 @@ export default function Login() {
|
||||
color={"teal"}
|
||||
onClick={() => {
|
||||
onLogin();
|
||||
setLoading(true);
|
||||
}}
|
||||
loading={loading ? true : false}
|
||||
loaderPosition="center"
|
||||
|
||||
@@ -35,6 +35,7 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
|
||||
export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
const router = useRouter();
|
||||
@@ -85,8 +86,12 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
if (res.status === 200) {
|
||||
await auth_funEditAktivasiKodeOtpById(dataOtp.id).then((val) => {
|
||||
if (val.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterHome.main_home);
|
||||
if (res.role === "1") {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterHome.main_home);
|
||||
} else {
|
||||
router.push(RouterAdminDashboard.splash_admin)
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(val.message);
|
||||
}
|
||||
@@ -183,7 +188,7 @@ export default function Validasi({ dataOtp }: { dataOtp: any }) {
|
||||
color={"teal"}
|
||||
onClick={() => {
|
||||
onVerifikasi();
|
||||
setLoading(true)
|
||||
setLoading(true);
|
||||
}}
|
||||
>
|
||||
<Text>VERIFIKASI</Text>
|
||||
|
||||
Reference in New Issue
Block a user