add admin logout

このコミットが含まれているのは:
dragon1211 2021-10-20 20:25:21 +09:00
コミット 0fc8dc24e6
2個のファイルの変更30行の追加11行の削除

ファイルの表示

@ -16537,7 +16537,7 @@ var AdminLogin = function AdminLogin() {
formdata.append('password', password);
axios__WEBPACK_IMPORTED_MODULE_2___default().post('/api/admin/login', formdata).then(function (response) {
if (response.data.status_code == 200) {
window.location.href = '';
window.location.href = '/admin/meeting';
} else if (response.data.status_code == 422) {
set422Errors(response.data.error_messages);
} else if (response.data.status_code == 400) {
@ -16603,8 +16603,7 @@ var AdminLogin = function AdminLogin() {
value: password,
onChange: function onChange(e) {
return setPassword(e.target.value);
},
autoFocus: true
}
}), _422errors.password && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span", {
className: "l-alert__text--error ft-16 ft-md-14",
children: _422errors.password
@ -16722,7 +16721,7 @@ var MeetingDetail = function MeetingDetail(props) {
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
var _props$match$params;
axios__WEBPACK_IMPORTED_MODULE_3___default().get("/api/meetings/detail/".concat((_props$match$params = props.match.params) === null || _props$match$params === void 0 ? void 0 : _props$match$params.meeting_id), {
axios__WEBPACK_IMPORTED_MODULE_3___default().get("/api/admin/fathers/meetings/detail/".concat((_props$match$params = props.match.params) === null || _props$match$params === void 0 ? void 0 : _props$match$params.meeting_id), {
params: {
father_id: 1
}
@ -17171,7 +17170,7 @@ var Meeting = function Meeting() {
setInCompleteOfFather = _useState10[1];
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
axios__WEBPACK_IMPORTED_MODULE_2___default().get('/api/meetings/listOfCompleteOfFather', {
axios__WEBPACK_IMPORTED_MODULE_2___default().get('/api/admin/fathers/meetings/listOfCompleteOfFather', {
params: {
father_id: 1
}
@ -17185,7 +17184,7 @@ var Meeting = function Meeting() {
});
}, []);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
axios__WEBPACK_IMPORTED_MODULE_2___default().get('/api/meetings/listOfIncompleteOfFather', {
axios__WEBPACK_IMPORTED_MODULE_2___default().get('/api/admin/fathers/meetings/listOfIncompleteOfFather', {
params: {
father_id: 1
}
@ -18479,6 +18478,12 @@ function Side() {
selected = _useState2[0],
setSelected = _useState2[1];
var handleLogout = function handleLogout() {
axios.get('/admin/logout').then(function () {
return location.href = '/admin/login';
});
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", {
className: "l-side",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("div", {
@ -18540,10 +18545,14 @@ function Side() {
})]
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("li", {
className: "mypage-nav-list__item -logout",
className: "mypage-nav-list__item ".concat(selected == 'logout' && "nav-active"),
onClick: function onClick(e) {
e.preventDefault();
setSelected('logout');
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("a", {
href: "",
className: "mypage-nav-list__link",
onClick: handleLogout,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("i", {
className: "icon log-out"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("span", {

ファイルの表示

@ -4,6 +4,11 @@ import { Link } from 'react-router-dom'
export default function Side() {
const [selected, setSelected] = useState('');
const handleLogout = () => {
axios.get('/admin/logout')
.then(() => location.href = '/admin/login')
}
return (
<div className="l-side">
<div className="l-side-logo">
@ -45,12 +50,17 @@ export default function Side() {
</Link>
</li>
<li className="mypage-nav-list__item -logout">
<a href="/admin/logout" className="mypage-nav-list__link">
<li className={`mypage-nav-list__item ${(selected == 'logout') && "nav-active"}`}
onClick={e => {
e.preventDefault();
setSelected('logout');
}}>
<a className="mypage-nav-list__link" onClick={handleLogout}>
<i className="icon log-out"></i><span>ログアウト</span>
</a>
</li>
</ul>
</nav>
</div>