2021-11-09 16:53:39 +09:00
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
import axios from 'axios';
|
|
|
|
import { LoadingButton } from '@material-ui/lab';
|
|
|
|
|
2021-11-10 21:51:53 +09:00
|
|
|
import Notification from '../notification';
|
2021-11-09 16:53:39 +09:00
|
|
|
|
|
|
|
const ProfileWithdrawal = () => {
|
|
|
|
|
|
|
|
const [submit, setSubmit] = useState(false);
|
|
|
|
const [_400error, set400Error] = useState('');
|
|
|
|
|
|
|
|
const handleSubmit = (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
setSubmit(true);
|
|
|
|
let child_id = document.getElementById("child_id").value;
|
|
|
|
axios.delete('/api/children/withdrawal', {params:{child_id: child_id}})
|
|
|
|
.then(response => {
|
|
|
|
setSubmit(false);
|
|
|
|
switch(response.data.status_code){
|
|
|
|
case 200: window.location.href = "/c-account/withdrawal/complete"; break;
|
|
|
|
case 400: set400Error("失敗しました。"); break;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="l-content">
|
|
|
|
<div className="l-content-w560">
|
|
|
|
<div className="l-content__ttl">
|
|
|
|
<div className="l-content__ttl__left">
|
|
|
|
<h2>退会確認</h2>
|
|
|
|
</div>
|
|
|
|
<Notification/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="l-content-wrap">
|
|
|
|
<section className="edit-container">
|
|
|
|
<div className="edit-wrap">
|
|
|
|
<div className="edit-content">
|
|
|
|
|
|
|
|
<form className="edit-form" onSubmit={handleSubmit} noValidate>
|
|
|
|
<div className="edit-set-bg ft-xs-16">
|
|
|
|
<p>本当に退会してもよろしいでしょうか?</p>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<LoadingButton type="submit" fullWidth
|
|
|
|
loading = {submit}
|
|
|
|
className="btn-edit btn-default btn-h75 bg-yellow rounded-20">
|
|
|
|
<span className={`ft-16 font-weight-bold ${!submit && 'text-black'}`}>退会する</span>
|
|
|
|
</LoadingButton>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{
|
|
|
|
_400error &&
|
|
|
|
<Alert type="fail" hide={()=>set400Error('')}>{_400error}</Alert>
|
|
|
|
}
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default ProfileWithdrawal;
|