Compare commits
2 Commits
v1.6.0
...
mobile-api
| Author | SHA1 | Date | |
|---|---|---|---|
| 0271c87ba9 | |||
| 5551f30721 |
@@ -14,8 +14,6 @@ export async function POST(req: Request) {
|
|||||||
try {
|
try {
|
||||||
const { data } = await req.json();
|
const { data } = await req.json();
|
||||||
|
|
||||||
console.log("data >>", data);
|
|
||||||
|
|
||||||
const cekUsername = await prisma.user.findUnique({
|
const cekUsername = await prisma.user.findUnique({
|
||||||
where: {
|
where: {
|
||||||
username: data.username,
|
username: data.username,
|
||||||
@@ -29,12 +27,12 @@ export async function POST(req: Request) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ✅ Validasi wajib setuju Terms
|
// ✅ Validasi wajib setuju Terms
|
||||||
if (data.termsOfServiceAccepted !== true) {
|
// if (data.termsOfServiceAccepted !== true) {
|
||||||
return NextResponse.json({
|
// return NextResponse.json({
|
||||||
success: false,
|
// success: false,
|
||||||
message: "You must agree to the Terms of Service",
|
// message: "You must agree to the Terms of Service",
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
const createUser = await prisma.user.create({
|
const createUser = await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -28,13 +28,10 @@ export default function Login({ version }: { version: string }) {
|
|||||||
const [countryCode, setCountryCode] = useState<string>("62"); // default ke Indonesia
|
const [countryCode, setCountryCode] = useState<string>("62"); // default ke Indonesia
|
||||||
|
|
||||||
async function onLogin() {
|
async function onLogin() {
|
||||||
console.log("phone >>", phone);
|
|
||||||
|
|
||||||
const nomor = phone;
|
const nomor = phone;
|
||||||
if (nomor.length <= 4) return setError(true);
|
if (nomor.length <= 4) return setError(true);
|
||||||
|
|
||||||
const fixPhone = `${countryCode}${nomor}`;
|
const fixPhone = `${countryCode}${nomor}`;
|
||||||
console.log("fixPhone >>", fixPhone);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -46,7 +43,6 @@ export default function Login({ version }: { version: string }) {
|
|||||||
router.push("/validasi", { scroll: false });
|
router.push("/validasi", { scroll: false });
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
console.log("respone >>", respone);
|
|
||||||
ComponentGlobal_NotifikasiPeringatan(respone?.message);
|
ComponentGlobal_NotifikasiPeringatan(respone?.message);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -108,9 +104,6 @@ export default function Login({ version }: { version: string }) {
|
|||||||
// Simpan hasil akhir
|
// Simpan hasil akhir
|
||||||
setCountryCode(dialCode);
|
setCountryCode(dialCode);
|
||||||
setPhone(localNumber);
|
setPhone(localNumber);
|
||||||
|
|
||||||
// console.log("Country Code:", dialCode);
|
|
||||||
// console.log("Clean Local Number:", localNumber);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user