コミット
66ae189ccb
|
@ -12897,7 +12897,7 @@ categories: [project]
|
|||
@font-face {
|
||||
font-family: "iconfont";
|
||||
src: url(/fonts/iconfont.eot?9bd2f8e21fb68f3cb69f306c7a5a07d2);
|
||||
src: url(/fonts/iconfont.eot?9bd2f8e21fb68f3cb69f306c7a5a07d2) format("eot"), url(/fonts/iconfont.woff?72290a51f520574be856b3621acc29a1) format("woff"), url(/fonts/iconfont.ttf?e240ce427caf7549e576c77b39a1d3f1) format("truetype"), url(/fonts/iconfont.svg?d812f238f7ec32f5cb5ebd322f320a02) format("svg");
|
||||
src: url(/fonts/iconfont.eot?9bd2f8e21fb68f3cb69f306c7a5a07d2) format("eot"), url(/fonts/iconfont.woff?72290a51f520574be856b3621acc29a1) format("woff"), url(/fonts/iconfont.ttf?e240ce427caf7549e576c77b39a1d3f1) format("truetype"), url(/fonts/iconfont.svg?9e48c54f8bbb472c1c286234fdd6636f) format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
|
ファイル差分が大きすぎるため省略します
差分を読み込み
|
@ -1,14 +1,13 @@
|
|||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { LoadingButton } from '@material-ui/lab';
|
||||
import { useCookies } from 'react-cookie';
|
||||
|
||||
import Alert from '../../component/alert';
|
||||
|
||||
const AdminLogin = () => {
|
||||
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
const location = useLocation();
|
||||
const navigator = useNavigate();
|
||||
|
||||
const [email, setEmail] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
|
@ -28,11 +27,7 @@ const AdminLogin = () => {
|
|||
|
||||
switch (response.data.status_code) {
|
||||
case 200: {
|
||||
localStorage.setItem('kiki_login_flag', true);
|
||||
localStorage.setItem('kiki_acc_type', 'admin');
|
||||
localStorage.setItem('kiki_acc_id', response.data.params.id);
|
||||
setCookie('logged', 'success');
|
||||
if (location.search == '')
|
||||
if(location.search == '')
|
||||
window.location.href = "/admin/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
|
@ -47,35 +42,38 @@ const AdminLogin = () => {
|
|||
}
|
||||
}, [])
|
||||
|
||||
const init_error = () => {
|
||||
set422Errors({ email:null, password:null });
|
||||
set400Error(null);
|
||||
|
||||
const loginOK = (id) => {
|
||||
let token = {
|
||||
type: 'admin',
|
||||
id: id,
|
||||
from_login: true
|
||||
};
|
||||
localStorage.setItem('admin_token', JSON.stringify(token));
|
||||
|
||||
if(location.search == '')
|
||||
window.location.href = "/admin/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
}
|
||||
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
set422Errors({ email:'', password:'' });
|
||||
setSubmit(true); //show progressbar
|
||||
const formdata = new FormData();
|
||||
formdata.append('email', email);
|
||||
formdata.append('password', password);
|
||||
|
||||
init_error();
|
||||
|
||||
axios.post('/api/admin/login', formdata)
|
||||
.then(response => {
|
||||
if(isMountedRef.current) return;
|
||||
setSubmit(false)
|
||||
switch(response.data.status_code){
|
||||
case 200: {
|
||||
localStorage.setItem('kiki_login_flag', true);
|
||||
localStorage.setItem('kiki_acc_type', 'admin');
|
||||
setCookie('logged', 'success');
|
||||
if(location.search == '')
|
||||
window.location.href = "/admin/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
|
||||
loginOK(response.data.params.id);
|
||||
break;
|
||||
}
|
||||
case 422: {
|
||||
|
|
|
@ -51,8 +51,8 @@ const AdminParentDetail = () => {
|
|||
set400Error("失敗しました。");
|
||||
}
|
||||
})
|
||||
return function cleanup() {
|
||||
isMountedRef.current = true;
|
||||
return () => {
|
||||
isMountedRef.current = true
|
||||
}
|
||||
},[]);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ const AdminParents = () => {
|
|||
set400Error("失敗しました。");
|
||||
}
|
||||
});
|
||||
return function cleanup() {
|
||||
return () => {
|
||||
isMountedRef.current = true
|
||||
}
|
||||
}, []);
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useCookies } from 'react-cookie';
|
||||
|
||||
export default function AdminSide() {
|
||||
const [selected, setSelected] = useState('');
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
|
||||
const handleLogout = () => {
|
||||
axios.get('/admin/logout')
|
||||
.then(() => {
|
||||
setCookie('logged', null);
|
||||
localStorage.removeItem('admin_token');
|
||||
window.location.href = '/admin/login';
|
||||
})
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ const ChildForgotPassword = () => {
|
|||
</LoadingButton>
|
||||
|
||||
{ _400error && <Alert type="fail" hide={()=>set400Error('')}>{_400error}</Alert> }
|
||||
{ _success && <Alert type="success" hide={()=>setSucess('')}> {_success}</Alert> }
|
||||
{ _success && <Alert type="success" hide={()=>setSuccess('')}> {_success}</Alert> }
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { LoadingButton } from '@material-ui/lab';
|
||||
import { useCookies } from 'react-cookie';
|
||||
import Alert from '../../../component/alert';
|
||||
|
||||
|
||||
const ChildLogin = () => {
|
||||
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
const location = useLocation();
|
||||
|
||||
const [submit, setSubmit] = useState(false);
|
||||
|
@ -28,11 +26,7 @@ const ChildLogin = () => {
|
|||
|
||||
switch (response.data.status_code) {
|
||||
case 200: {
|
||||
localStorage.setItem('kiki_login_flag', true);
|
||||
localStorage.setItem('kiki_acc_type', 'c-account');
|
||||
localStorage.setItem('kiki_acc_id', response.data.params.id);
|
||||
setCookie('logged', 'success');
|
||||
if (location.search == '')
|
||||
if(location.search == '')
|
||||
window.location.href = "/c-account/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
|
@ -48,6 +42,23 @@ const ChildLogin = () => {
|
|||
}, [])
|
||||
|
||||
|
||||
const loginOK = (id = 0) =>{
|
||||
let token = {
|
||||
type: 'c-account',
|
||||
id: id,
|
||||
notice: 0,
|
||||
from_login: true
|
||||
};
|
||||
localStorage.setItem('c-account_token', JSON.stringify(token));
|
||||
localStorage.setItem('child_id', id);
|
||||
|
||||
if(location.search == '')
|
||||
window.location.href = "/c-account/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
}
|
||||
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
setSubmit(true);
|
||||
|
@ -64,14 +75,7 @@ const ChildLogin = () => {
|
|||
setSubmit(false)
|
||||
switch(response.data.status_code){
|
||||
case 200:{
|
||||
localStorage.setItem("kiki_login_flag", true);
|
||||
localStorage.setItem('kiki_acc_type', 'c-account');
|
||||
localStorage.setItem('kiki_acc_id', response.data.params.id);
|
||||
setCookie('logged', 'success');
|
||||
if(location.search == '')
|
||||
window.location.href = "/c-account/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
loginOK(response.data.params.id);
|
||||
break;
|
||||
}
|
||||
case 400: set400Error(response.data.error_message); break;
|
||||
|
|
|
@ -15,8 +15,8 @@ const ChildMeetingDetail = () => {
|
|||
const navigator = useNavigate();
|
||||
const params = useParams(); //meeting/detail/:meeting_id
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const [meeting, setMeeting] = useState(null);
|
||||
|
@ -66,7 +66,7 @@ const ChildMeetingDetail = () => {
|
|||
}
|
||||
})
|
||||
|
||||
return function cleanup() {
|
||||
return () => {
|
||||
isMountedRef.current = true
|
||||
}
|
||||
},[]);
|
||||
|
|
|
@ -12,8 +12,8 @@ const SCROLL_DELAY_TIME = 1500;
|
|||
|
||||
const ChildMeetings = () => {
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const [tab_status, setTabStatus] = useState(false);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const [loaded1, setLoaded1] = useState(false);
|
||||
|
@ -73,8 +73,8 @@ const ChildMeetings = () => {
|
|||
}
|
||||
})
|
||||
|
||||
return function cleanup() {
|
||||
isMountedRef.current = true;
|
||||
return () => {
|
||||
isMountedRef.current = true
|
||||
}
|
||||
},[]);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ const ChildParentDetail = () => {
|
|||
const navigator = useNavigate();
|
||||
const params = useParams();
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const [parent, setParent] = useState(null);
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ const SCROLL_DELAY_TIME = 1500;
|
|||
|
||||
const ChildParents = () => {
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [parent_list, setParentList] = useState([]);
|
||||
const [fetch_parent_list, setFetchParentList] = useState([]);
|
||||
|
|
|
@ -11,8 +11,8 @@ const ChildProfileEdit = () => {
|
|||
|
||||
const navigator = useNavigate();
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [first_name, setFirstName] = useState('');
|
||||
const [last_name, setLastName] = useState('');
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import React, { useRef, useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import PhotoCameraOutlinedIcon from '@mui/icons-material/PhotoCameraOutlined';
|
||||
import { useCookies } from 'react-cookie';
|
||||
|
||||
import Alert from '../../component/alert';
|
||||
import PageLoader from '../../component/page_loader';
|
||||
|
@ -11,10 +10,10 @@ import Notification from '../../component/notification';
|
|||
|
||||
const ChildProfileDetail = () => {
|
||||
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
const navigator = useNavigate();
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [image, setImage] = useState('');
|
||||
const [profile, setProfile] = useState(null)
|
||||
|
@ -69,7 +68,7 @@ const ChildProfileDetail = () => {
|
|||
const handleLogout = () => {
|
||||
axios.get('/c-account/logout')
|
||||
.then(() => {
|
||||
setCookie('logged', null);
|
||||
localStorage.removeItem('c-account_token');
|
||||
window.location.href = '/c-account/login';
|
||||
})
|
||||
}
|
||||
|
@ -147,7 +146,7 @@ const ChildProfileDetail = () => {
|
|||
</p>
|
||||
<p className="txt">{profile.identity}</p>
|
||||
<a target='_blank'
|
||||
href={'http://line.me/R/msg/text/?'+
|
||||
href={'http://line.naver.jp/R/msg/text/?'+
|
||||
`${profile.last_name}%20${profile.first_name}さんがIDを共有しました。%0AIDはこちら%0A%0A${profile.identity}%0A%0AIDをコピーしてメンバー追加してください。%0A%0AKIKI運営事務局`}>
|
||||
IDを教える
|
||||
</a>
|
||||
|
|
|
@ -10,8 +10,8 @@ const ChildProfilePasswordEdit = () => {
|
|||
|
||||
const navigator = useNavigate();
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [password, setPassword] = useState('');
|
||||
const [password_confirmation, setConfirmPassword] = useState('');
|
||||
|
|
|
@ -6,8 +6,8 @@ import Alert from '../../component/alert';
|
|||
|
||||
const ChildProfileWithdrawal = () => {
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const [submit, setSubmit] = useState(false);
|
||||
const [_400error, set400Error] = useState('');
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ const ChildSearch = () => {
|
|||
const [loaded, setLoaded] = useState(true);
|
||||
const [initPage, setInitPage] = useState(true);
|
||||
|
||||
const child_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const child_id = localStorage.getItem('child_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
|
||||
const isMountedRef = useRef(true);
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useCookies } from 'react-cookie';
|
||||
|
||||
export default function ChildSide() {
|
||||
const [selected, setSelected] = useState('');
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
|
||||
const child_img = document.getElementById('child_image').value;
|
||||
|
||||
const handleLogout = () => {
|
||||
axios.get('/c-account/logout')
|
||||
.then(() => {
|
||||
setCookie('logged', null);
|
||||
localStorage.removeItem('c-account_token');
|
||||
window.location.href = '/c-account/login';
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,22 +1,28 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import Alert from './alert';
|
||||
|
||||
export default function AlertStateMessage() {
|
||||
const { pathname, state } = useLocation();
|
||||
const location = useLocation();
|
||||
const navigator = useNavigate();
|
||||
const [_success, setSuccess] = useState('');
|
||||
const [_400error, set400Error] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if(state){
|
||||
if(state){
|
||||
if( pathname.search('/register/error') > 0){
|
||||
set400Error(state);
|
||||
}
|
||||
else{
|
||||
setSuccess(state);
|
||||
navigator(pathname);
|
||||
}
|
||||
}
|
||||
navigator(pathname);
|
||||
}
|
||||
}, [pathname]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{ _400error ? <Alert type="fail" hide={()=>set400Error('')}>{_400error}</Alert> : null}
|
||||
{ _success ? <Alert type="success" hide={()=>setSuccess('')}>{ _success }</Alert> : null}
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import Alert from './alert';
|
||||
|
||||
export default function CheckLoginStatus() {
|
||||
const { pathname } = useLocation();
|
||||
const [_success, setSuccess] = useState('');
|
||||
const navigator = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
const acc_type = pathname.split('/')[1];
|
||||
|
||||
let token = localStorage.getItem(`${acc_type}_token`);
|
||||
if(!token){
|
||||
navigator(`/${acc_type}/login`);
|
||||
}
|
||||
else{
|
||||
token = JSON.parse(token);
|
||||
if(token.from_login) {
|
||||
setSuccess('ログインに成功しました');
|
||||
token.from_login = false;
|
||||
localStorage.setItem(`${acc_type}_token`, JSON.stringify(token));
|
||||
}
|
||||
}
|
||||
}, [pathname]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{ _success ? <Alert type="success" hide={()=>setSuccess('')}>{ _success }</Alert> : null}
|
||||
</>
|
||||
);
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
|
||||
const Notification = ({ notice }) => {
|
||||
|
||||
const navigator = useNavigate();
|
||||
const { pathname } = useLocation();
|
||||
const [number, setNumber] = useState(-1);
|
||||
|
||||
const handleClick = () => {
|
||||
var navbar_list = document.getElementsByClassName("mypage-nav-list__item");
|
||||
|
@ -15,7 +16,17 @@ const Notification = ({ notice }) => {
|
|||
}
|
||||
|
||||
useEffect(()=>{
|
||||
localStorage.setItem("notice", notice);
|
||||
|
||||
let token = localStorage.getItem(`${pathname.split('/')[1]}_token`);
|
||||
if(!token) return;
|
||||
token = JSON.parse(token);
|
||||
if(notice < 0){
|
||||
setNumber(token.notice);
|
||||
} else {
|
||||
token.notice = notice;
|
||||
localStorage.setItem(`${pathname.split('/')[1]}_token`, JSON.stringify(token));
|
||||
setNumber(notice);
|
||||
}
|
||||
}, [notice]);
|
||||
|
||||
return (
|
||||
|
@ -23,8 +34,8 @@ const Notification = ({ notice }) => {
|
|||
<div className="p-notification-icon">
|
||||
<div className="p-notification-icon-wrap">
|
||||
{
|
||||
notice > 0 &&
|
||||
<div className="count">{notice}</div>
|
||||
number > 0 &&
|
||||
<div className="count">{number}</div>
|
||||
}
|
||||
<div className="p-notification-icon-bg"></div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22.742 19.855" className="icon svg-icon svg-fill svg-y50" ><g fill="none" stroke="#080808" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5" data-name="Icon feather-alert-triangle" transform="translate(0.777 0.75)"><path d="M11.188,5.322,2.6,19.659A2.028,2.028,0,0,0,4.334,22.7H21.51a2.028,2.028,0,0,0,1.734-3.042L14.656,5.322a2.028,2.028,0,0,0-3.468,0Z" data-name="パス 3" transform="translate(-2.328 -4.346)"/><path d="M18,13.5v6.91" data-name="パス 4" transform="translate(-7.406 -8.547)"/><path d="M18,25.5h0" data-name="パス 5" transform="translate(-7.406 -11.2)"/></g></svg>
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
import axios from "axios";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { useCookies } from 'react-cookie';
|
||||
import Alert from './alert';
|
||||
|
||||
export default function PageChangeHandler() {
|
||||
const { pathname } = useLocation();
|
||||
const navigator = useNavigate();
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
const [_success, setSuccess] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if(localStorage.getItem('kiki_login_flag')) {
|
||||
setSuccess('ログインに成功しました');
|
||||
localStorage.removeItem('kiki_login_flag');
|
||||
}
|
||||
loginAccountCheck();
|
||||
}, [pathname]);
|
||||
|
||||
const loginAccountCheck = () => {
|
||||
let acc = pathname.split('/')[1];
|
||||
let acc_type = localStorage.getItem('kiki_acc_type');
|
||||
if((acc_type && (acc != acc_type))) {
|
||||
window.location.href = `/${acc}/login`;
|
||||
axios.get(`/${acc}/logout`);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{ _success ? <Alert type="success" hide={()=>setSuccess('')}>{ _success }</Alert> : null}
|
||||
</>
|
||||
);
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
import { Outlet } from 'react-router-dom';
|
||||
import PageChangeHandler from '../component/page_change_handler';
|
||||
import CheckLoginStatus from '../component/check_login_status';
|
||||
import AlertStateMessage from '../component/alert_state_msg';
|
||||
|
||||
const DashboardLayout = ({side}) => {
|
||||
|
||||
return (
|
||||
<main className="l-container meeting-consent">
|
||||
<PageChangeHandler />
|
||||
<AlertStateMessage />
|
||||
<AlertStateMessage />
|
||||
<CheckLoginStatus />
|
||||
<Outlet />
|
||||
{side}
|
||||
</main>
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { LoadingButton } from '@material-ui/lab';
|
||||
import { useCookies } from 'react-cookie';
|
||||
|
||||
import Alert from '../../../component/alert';
|
||||
|
||||
|
||||
const ParentLogin = () => {
|
||||
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
const location = useLocation();
|
||||
|
||||
const [submit, setSubmit] = useState(false);
|
||||
|
@ -30,11 +28,7 @@ const ParentLogin = () => {
|
|||
|
||||
switch (response.data.status_code) {
|
||||
case 200: {
|
||||
localStorage.setItem('kiki_login_flag', true);
|
||||
localStorage.setItem('kiki_acc_type', 'p-account');
|
||||
localStorage.setItem('kiki_acc_id', response.data.params.id);
|
||||
setCookie('logged', 'success');
|
||||
if (location.search == '')
|
||||
if(location.search == '')
|
||||
window.location.href = "/p-account/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
|
@ -49,6 +43,23 @@ const ParentLogin = () => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
|
||||
const loginOK = (id) =>{
|
||||
let token = {
|
||||
type: 'p-account',
|
||||
id: id,
|
||||
notice: 0,
|
||||
from_login: true
|
||||
};
|
||||
localStorage.setItem('p-account_token', JSON.stringify(token));
|
||||
localStorage.setItem('father_id', id);
|
||||
|
||||
if(location.search == '')
|
||||
window.location.href = "/p-account/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
}
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
setSubmit(true);
|
||||
|
@ -66,14 +77,7 @@ const ParentLogin = () => {
|
|||
setSubmit(false)
|
||||
switch(response.data.status_code){
|
||||
case 200:{
|
||||
localStorage.setItem('kiki_login_flag', true);
|
||||
localStorage.setItem('kiki_acc_type', 'p-account');
|
||||
localStorage.setItem('kiki_acc_id', response.data.params.id);
|
||||
setCookie('logged', 'success');
|
||||
if(location.search == '')
|
||||
window.location.href = "/p-account/meeting";
|
||||
else
|
||||
window.location.href = location.search.replace('?redirect_to=', '');
|
||||
loginOK(response.data.params.id);
|
||||
break;
|
||||
}
|
||||
case 400: set400Error(response.data.error_message); break;
|
||||
|
|
|
@ -79,8 +79,8 @@ const LineModal = ({ show, handleClose }) => {
|
|||
|
||||
|
||||
const ParentChildAdd = () => {
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
|
||||
const [loaded, setLoaded] = useState(true);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ const ParentChildDetail = () => {
|
|||
const navigator = useNavigate();
|
||||
const params = useParams();
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const [show_delete, setShowDelete] = useState(false);
|
||||
const [submit, setSubmit] = useState(false);
|
||||
|
@ -21,7 +21,7 @@ const ParentChildDetail = () => {
|
|||
const [_404error, set404Error] = useState('');
|
||||
const [_success, setSuccess] = useState('');
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const child_id = params?.child_id;
|
||||
const isMountedRef = useRef(true);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const ParentChildEdit = () => {
|
|||
const navigator = useNavigate();
|
||||
const params = useParams();
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const [_success, setSuccess] = useState('');
|
||||
const [_400error, set400Error] = useState('');
|
||||
const [_404error, set404Error] = useState('');
|
||||
|
@ -25,7 +25,7 @@ const ParentChildEdit = () => {
|
|||
const [submit, setSubmit] = useState(false);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const child_id = params?.child_id;
|
||||
|
||||
const isMountedRef = useRef(true);
|
||||
|
|
|
@ -11,8 +11,8 @@ const SCROLL_DELAY_TIME = 1500;
|
|||
|
||||
const ParentChilds = () => {
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
|
||||
const [children_list, setChildrenList] = useState([]);
|
||||
const [fetch_children_list, setFetchChildrenList] = useState([]);
|
||||
|
|
|
@ -14,8 +14,8 @@ const SCROLL_DELAY_TIME = 1500;
|
|||
|
||||
const ParentFavorite = () => {
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
|
||||
const [tab_status, setTabStatus] = useState(false);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
|
|
@ -15,9 +15,9 @@ const ParentMeetingAdd = () => {
|
|||
const navigator = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [title, setTitle] = useState('');
|
||||
const [memo, setMemo] = useState('');
|
||||
|
|
|
@ -17,8 +17,8 @@ const ParentMeetingDetail = () => {
|
|||
const navigator = useNavigate();
|
||||
const params = useParams();
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const [loaded_children, setLoadedChildren] = useState(false);
|
||||
|
|
|
@ -18,9 +18,9 @@ const ParentMeetingEdit = () => {
|
|||
const navigator = useNavigate();
|
||||
const params = useParams();
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const meeting_id = params?.meeting_id;
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [title, setTitle] = useState('');
|
||||
const [memo, setMemo] = useState('');
|
||||
|
|
|
@ -13,8 +13,8 @@ const SCROLL_DELAY_TIME = 1500;
|
|||
|
||||
const ParentMeetings = () => {
|
||||
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
|
||||
const [tab_status, setTabStatus] = useState(false);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
|
|
@ -9,8 +9,8 @@ const ParentProfileEdit = () => {
|
|||
|
||||
const navigator = useNavigate();
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [company, setCompany] = useState('');
|
||||
const [email, setEmail] = useState('');
|
||||
|
|
|
@ -2,7 +2,6 @@ import React, { useRef, useEffect, useState } from 'react';
|
|||
import { useNavigate, Link } from 'react-router-dom';
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import PhotoCameraOutlinedIcon from '@mui/icons-material/PhotoCameraOutlined';
|
||||
import { useCookies } from 'react-cookie';
|
||||
|
||||
import Alert from '../../component/alert';
|
||||
import PageLoader from '../../component/page_loader';
|
||||
|
@ -11,10 +10,9 @@ import Notification from '../../component/notification';
|
|||
const ParentProfileDetail = () => {
|
||||
|
||||
const navigator = useNavigate();
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [image, setImage] = useState('');
|
||||
const [profile, setProfile] = useState({company:'', email:'', tel:'', profile:''});
|
||||
|
@ -69,7 +67,7 @@ const ParentProfileDetail = () => {
|
|||
const handleLogout = () => {
|
||||
axios.get('/p-account/logout')
|
||||
.then(() => {
|
||||
setCookie('logged', null);
|
||||
localStorage.removeItem('p-account_token');
|
||||
window.location.href = '/p-account/login';
|
||||
})
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ const ParentProfilePasswordEdit = () => {
|
|||
|
||||
const navigator = useNavigate();
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [password, setPassword] = useState('');
|
||||
const [password_confirmation, setConfirmPassword] = useState('');
|
||||
|
|
|
@ -5,8 +5,8 @@ import Alert from '../../component/alert';
|
|||
|
||||
const ParentProfileWithdrawal = () => {
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [submit, setSubmit] = useState(false);
|
||||
const [_400error, set400Error] = useState('');
|
||||
|
|
|
@ -14,8 +14,8 @@ const SCROLL_DELAY_TIME = 1500;
|
|||
|
||||
const ParentSearch = () => {
|
||||
|
||||
const father_id = localStorage.getItem('kiki_acc_id');
|
||||
const [notice, setNotice] = useState(localStorage.getItem('notice'));
|
||||
const father_id = localStorage.getItem('father_id');
|
||||
const [notice, setNotice] = useState(-1);
|
||||
|
||||
const [keyword, setKeyword] = useState('');
|
||||
const [tab_status, setTabStatus] = useState(false);
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useCookies } from 'react-cookie';
|
||||
|
||||
export default function ParentSide() {
|
||||
const [selected, setSelected] = useState('');
|
||||
const [cookies, setCookie] = useCookies(['user']);
|
||||
|
||||
const father_image = document.getElementById('father_image').value;
|
||||
|
||||
const handleLogout = () => {
|
||||
axios.get('/p-account/logout')
|
||||
.then(() => {
|
||||
setCookie('logged', null);
|
||||
localStorage.removeItem('p-account_token');
|
||||
window.location.href = '/p-account/login';
|
||||
})
|
||||
}
|
||||
|
|
新しいイシューから参照