Fakultas Ilmu Komputer UI

Commit 549deb5b authored by Nabila Febri Viola's avatar Nabila Febri Viola
Browse files

Merge branch 'warmfix-patch_account_register' into 'staging'

Warmfix patch account register

See merge request !37
parents 98045e93 abe7f132
Pipeline #39004 passed with stages
in 35 minutes and 34 seconds
......@@ -140,8 +140,9 @@ STATIC_ROOT = 'static_root/'
CORS_ORIGIN_WHITELIST = [
"http://localhost:8000",
"https://dblood-staging.netlify.app",
"https://dblood.netlify.app",
"http://localhost:8080",
"https://dblood-staging.netlify.com",
"https://dblood.netlify.com",
]
# REST Framework settings
......
......@@ -27,18 +27,3 @@ export const postUserLogout = () =>
detail: "SUCCESS",
},
})
export const postRegisterUser = async () =>
await fetch(`${BASE_API_URL}/auth/register-full/`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: data,
})
.then(async response => {
return await response.json()
})
.then(async data => {
return data
})
......@@ -2,6 +2,7 @@ import React from "react"
import { Form } from "react-bootstrap"
import { useForm } from "react-hook-form"
import * as yup from "yup"
import axios from "axios"
import { BASE_API_URL } from "../config"
import ModalRegisterAccount from "./register-account"
......@@ -68,35 +69,27 @@ const ModalRegister = ({ show, handleClose }) => {
validationSchema: schema,
})
const onSubmit = async data => {
data =
'{"email": "' +
data.email +
'", "password": "' +
data.password +
'", "first_name": "' +
data.first_name +
'", "profile": ' +
JSON.stringify(data) +
"}"
await fetch(`${BASE_API_URL}/auth/register-full/`, {
method: "POST",
headers: {
"Content-Type": "application/json",
await axios({
method: "post",
url: `${BASE_API_URL}/auth/register-full/`,
timeout: 60000,
data: {
email: data.email,
password: data.password,
first_name: data.first_name,
profile: data,
},
body: data,
})
.then(async response => {
return await response.json()
})
.then(async data => {
await window.alert(
"Silakan verifikasi email terlebih dahulu di" +
data.email +
.then(response => {
console.log(response.data)
window.alert(
"Silakan verifikasi email terlebih dahulu di " +
response.data.email +
" untuk login."
),
await location.reload()
location.reload()
})
.catch(error => console.error("timeout exceeded"))
}
return (
<>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment