From c6a489da2f3df46b867891c12a3c5f4121f920b0 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 17:11:09 +0700
Subject: fix

---
 src/lib/auth/components/Register.jsx | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'src/lib/auth/components/Register.jsx')

diff --git a/src/lib/auth/components/Register.jsx b/src/lib/auth/components/Register.jsx
index e3e3c4fa..df08541d 100644
--- a/src/lib/auth/components/Register.jsx
+++ b/src/lib/auth/components/Register.jsx
@@ -2,6 +2,7 @@ import Image from 'next/image'
 import Link from '@/core/components/elements/Link/Link'
 import IndoteknikLogo from '@/images/logo.png'
 import { useState } from 'react'
+import registerApi from '../api/registerApi'
 
 const Register = () => {
   const [fullname, setFullname] = useState('')
@@ -10,8 +11,16 @@ const Register = () => {
   const [companyName, setCompanyName] = useState('')
   const [isLoading, setIsLoading] = useState('')
 
-  const handleSubmit = (e) => {
+  const handleSubmit = async (e) => {
     e.preventDefault()
+    const data = {
+      name: fullname,
+      company: companyName,
+      email,
+      password
+    }
+    const isRegistered = await registerApi({ data })
+    console.log(isRegistered)
   }
 
   return (
@@ -27,7 +36,9 @@ const Register = () => {
 
       <form className='w-full mt-6 flex flex-col gap-y-4' onSubmit={handleSubmit}>
         <div>
-          <label htmlFor='companyName'>Nama Perusahaan <span className='text-gray_r-11'>(opsional)</span></label>
+          <label htmlFor='companyName'>
+            Nama Perusahaan <span className='text-gray_r-11'>(opsional)</span>
+          </label>
           <input
             type='text'
             id='companyName'
@@ -76,7 +87,7 @@ const Register = () => {
         <button
           type='submit'
           className='btn-yellow w-full mt-2'
-          disabled={!email || !password || isLoading}
+          disabled={!email || !password || !fullname || isLoading}
         >
           {!isLoading ? 'Daftar' : 'Loading...'}
         </button>
-- 
cgit v1.2.3

