feat : update otp

This commit is contained in:
lukman
2024-08-28 08:00:27 +08:00
parent bf35cd4592
commit 789c110616
4 changed files with 13 additions and 9 deletions

View File

@@ -50,7 +50,8 @@ function ViewLogin() {
const code = Math.floor(Math.random() * 1000) + 1000 const code = Math.floor(Math.random() * 1000) + 1000
setLoading(true) setLoading(true)
const res = await fetch(`https://wa.wibudev.com/code?nom=${cekLogin.phone}&text=${code}`).then( const res = await fetch(`https://wa.wibudev.com/code?nom=${cekLogin.phone}&text=*DARMASABA*%0A%0A
JANGAN BERIKAN KODE RAHASIA ini kepada siapa pun TERMASUK PIHAK DARMASABA. Masukkan otentikasi: *${encodeURIComponent(code)}*`).then(
async (res) => { async (res) => {
if (res.status == 200) { if (res.status == 200) {
setValPhone(cekLogin.phone) setValPhone(cekLogin.phone)

View File

@@ -16,7 +16,8 @@ export default function ViewVerification({ phone, otp, user }: IVerification) {
async function onResend() { async function onResend() {
const code = Math.floor(Math.random() * 1000) + 1000 const code = Math.floor(Math.random() * 1000) + 1000
const res = await fetch(`https://wa.wibudev.com/code?nom=${phone}&text=${code}`) const res = await fetch(`https://wa.wibudev.com/code?nom=${phone}&text=*DARMASABA*%0A%0A
JANGAN BERIKAN KODE RAHASIA ini kepada siapa pun TERMASUK PIHAK DARMASABA. Masukkan otentikasi: *${encodeURIComponent(code)}*`)
.then( .then(
async (res) => { async (res) => {
if (res.status == 200) { if (res.status == 200) {

View File

@@ -2,7 +2,7 @@
import { WARNA } from "@/module/_global"; import { WARNA } from "@/module/_global";
import LayoutModal from "@/module/_global/layout/layout_modal"; import LayoutModal from "@/module/_global/layout/layout_modal";
import { funGetAllGroup, IDataGroup } from "@/module/group"; import { funGetAllGroup, IDataGroup } from "@/module/group";
import { Box, Button, Select, Stack, TextInput } from "@mantine/core"; import { Box, Button, Select, Stack, Text, TextInput } from "@mantine/core";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import toast from "react-hot-toast"; import toast from "react-hot-toast";
@@ -343,7 +343,8 @@ export default function CreateMember() {
size="md" size="md"
type="number" type="number"
radius={30} radius={30}
placeholder="+62...." placeholder="87701795778"
leftSection={<Text>+62</Text>}
withAsterisk withAsterisk
label="Nomor Telepon" label="Nomor Telepon"
w={"100%"} w={"100%"}
@@ -357,7 +358,7 @@ export default function CreateMember() {
onChange={(event: any) => { onChange={(event: any) => {
setListData({ setListData({
...listData, ...listData,
phone: event.target.value, phone: "62" + event.target.value,
}) })
setTouched({ ...touched, phone: false }) setTouched({ ...touched, phone: false })
} }

View File

@@ -3,7 +3,7 @@ import { WARNA } from "@/module/_global";
import LayoutModal from "@/module/_global/layout/layout_modal"; import LayoutModal from "@/module/_global/layout/layout_modal";
import { funGetAllGroup, IDataGroup } from "@/module/group"; import { funGetAllGroup, IDataGroup } from "@/module/group";
import { funGetAllPosition } from "@/module/position/lib/api_position"; import { funGetAllPosition } from "@/module/position/lib/api_position";
import { Box, Button, Select, Stack, TextInput } from "@mantine/core"; import { Box, Button, Select, Stack, Text, TextInput } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks"; import { useShallowEffect } from "@mantine/hooks";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
@@ -299,7 +299,7 @@ export default function EditMember({ id }: { id: string }) {
} }
/> />
<TextInput <TextInput
size="md" type="number" radius={30} placeholder="+62...." withAsterisk label="Nomor Telepon" w={"100%"} size="md" type="number" radius={30} withAsterisk label="Nomor Telepon" w={"100%"}
styles={{ styles={{
input: { input: {
color: WARNA.biruTua, color: WARNA.biruTua,
@@ -307,8 +307,9 @@ export default function EditMember({ id }: { id: string }) {
borderColor: WARNA.biruTua, borderColor: WARNA.biruTua,
}, },
}} }}
placeholder="6287701795778"
onChange={(e) => { onChange={(e) => {
setData({ ...data, phone: e.target.value }) setData({ ...data, phone: e.target.value })
setTouched({ ...touched, phone: false }) setTouched({ ...touched, phone: false })
}} }}
value={data.phone} value={data.phone}