このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
kikikan/backend/resources/js/child/profile/withdrawal.jsx

69 行
2.6 KiB
React
Raw 通常表示 履歴

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-18 18:14:14 +09:00
import Alert from '../../component/alert';
2021-11-09 16:53:39 +09:00
const ProfileWithdrawal = () => {
2021-11-14 21:41:33 +09:00
const [notice, setNotice] = useState(localStorage.getItem('notice'));
2021-11-09 16:53:39 +09:00
const [submit, setSubmit] = useState(false);
const [_400error, set400Error] = useState('');
2021-11-11 14:33:17 +09:00
2021-11-09 16:53:39 +09:00
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);
2021-11-14 21:41:33 +09:00
setNotice(response.data.notice);
2021-11-09 16:53:39 +09:00
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>
2021-11-11 14:33:17 +09:00
<Notification notice={notice}/>
2021-11-09 16:53:39 +09:00
</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>
2021-11-17 23:56:11 +09:00
{ _400error && <Alert type="fail" hide={()=>set400Error('')}>{_400error}</Alert> }
2021-11-09 16:53:39 +09:00
</section>
</div>
</div>
</div>
)
}
export default ProfileWithdrawal;