title: auto

des: auto
note:auto
This commit is contained in:
2023-10-03 09:37:28 +08:00
parent bde21823de
commit 4f166804c4
8 changed files with 15 additions and 15 deletions

View File

@@ -1,11 +1,11 @@
import { MyConsole } from "@/app/fun/my_console"; import { myConsole } from "@/app/fun/my_console";
import prisma from "@/app/lib/prisma"; import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
export async function POST(req: Request) { export async function POST(req: Request) {
if (req.method === "POST") { if (req.method === "POST") {
const body = await req.json(); const body = await req.json();
MyConsole(body); myConsole(body);
try { try {
await fetch( await fetch(

View File

@@ -1,5 +1,5 @@
import { sealData } from "iron-session"; import { sealData } from "iron-session";
import { MyConsole } from "@/app/fun/my_console"; import { myConsole } from "@/app/fun/my_console";
import prisma from "@/app/lib/prisma"; import prisma from "@/app/lib/prisma";
import { data } from "autoprefixer"; import { data } from "autoprefixer";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
@@ -18,7 +18,7 @@ export async function POST(req: Request) {
}, },
}); });
MyConsole(cekUsername); myConsole(cekUsername);
if (cekUsername) if (cekUsername)
return NextResponse.json({ status: 400, message: "Username sudah ada" }); return NextResponse.json({ status: 400, message: "Username sudah ada" });

View File

@@ -1,4 +1,4 @@
import { MyConsole } from "@/app/fun/my_console"; import { myConsole } from "@/app/fun/my_console";
import prisma from "@/app/lib/prisma"; import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import { cookies } from "next/headers"; import { cookies } from "next/headers";
@@ -8,7 +8,7 @@ import {getConfig} from "@/bin/config";
export async function POST(req: Request) { export async function POST(req: Request) {
if (req.method === "POST") { if (req.method === "POST") {
const body = await req.json(); const body = await req.json();
MyConsole(body); myConsole(body);
const data = await prisma.user.findUnique({ const data = await prisma.user.findUnique({
where: { where: {

View File

@@ -1,6 +1,6 @@
import { useState } from "react"; import { useState } from "react";
export function MyConsole(value: any) { export function myConsole(value: any) {
const onData = false; const onData = false;
if (onData) { if (onData) {
console.log(value); console.log(value);

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { MyConsole } from "@/app/fun/my_console"; import { myConsole } from "@/app/fun/my_console";
import { randomOTP } from "@/app/fun/rondom_otp"; import { randomOTP } from "@/app/fun/rondom_otp";
import { ApiHipmi } from "@/app/lib/api"; import { ApiHipmi } from "@/app/lib/api";
import { Warna } from "@/app/lib/warna"; import { Warna } from "@/app/lib/warna";
@@ -37,7 +37,7 @@ export default function Login() {
}) })
.then((res) => res.json()) .then((res) => res.json())
.then((val) => { .then((val) => {
MyConsole(val); myConsole(val);
if (val.status == 200) { if (val.status == 200) {
toast(val.message); toast(val.message);
setCode(val.body.otp); setCode(val.body.otp);

View File

@@ -1,5 +1,5 @@
"use client"; "use client";
import { MyConsole } from "@/app/fun/my_console"; import { myConsole } from "@/app/fun/my_console";
import { ApiHipmi } from "@/app/lib/api"; import { ApiHipmi } from "@/app/lib/api";
import { Button } from "@mantine/core"; import { Button } from "@mantine/core";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";

View File

@@ -6,7 +6,7 @@ import { IconCircleLetterH } from "@tabler/icons-react";
import { gs_nomor } from "../state/state"; import { gs_nomor } from "../state/state";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { useState } from "react"; import { useState } from "react";
import { MyConsole } from "@/app/fun/my_console"; import { myConsole } from "@/app/fun/my_console";
import toast from "react-simple-toasts"; import toast from "react-simple-toasts";
import { ApiHipmi } from "@/app/lib/api"; import { ApiHipmi } from "@/app/lib/api";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
@@ -17,7 +17,7 @@ export default function Register() {
const [value, setValue] = useState(""); const [value, setValue] = useState("");
const onRegister = async () => { const onRegister = async () => {
MyConsole(value); myConsole(value);
const body = { const body = {
username: value, username: value,
@@ -36,7 +36,7 @@ export default function Register() {
}) })
.then((res) => res.json()) .then((res) => res.json())
.then((val) => { .then((val) => {
MyConsole(val); myConsole(val);
if (val.status == 201) { if (val.status == 201) {
toast("Pendaftaran Berhasil"); toast("Pendaftaran Berhasil");
return route.push("/dev/home"); return route.push("/dev/home");

View File

@@ -13,7 +13,7 @@ import {
import { gs_nomor, gs_otp } from "../state/state"; import { gs_nomor, gs_otp } from "../state/state";
import { Warna } from "@/app/lib/warna"; import { Warna } from "@/app/lib/warna";
import { useState } from "react"; import { useState } from "react";
import { MyConsole } from "@/app/fun/my_console"; import { myConsole } from "@/app/fun/my_console";
import { IconCircleLetterH } from "@tabler/icons-react"; import { IconCircleLetterH } from "@tabler/icons-react";
import toast from "react-simple-toasts"; import toast from "react-simple-toasts";
import { ApiHipmi } from "@/app/lib/api"; import { ApiHipmi } from "@/app/lib/api";
@@ -45,7 +45,7 @@ export default function Validasi() {
}) })
.then((res) => res.json()) .then((res) => res.json())
.then((val) => { .then((val) => {
MyConsole(val); myConsole(val);
if (val.status == 200) { if (val.status == 200) {
toast("Berhasil Login"); toast("Berhasil Login");
return router.push("/dev/home"); return router.push("/dev/home");