wip
This commit is contained in:
parent
347a5680ae
commit
ba40952a09
7 changed files with 99 additions and 49 deletions
|
@ -2,4 +2,20 @@ import * as React from 'react';
|
|||
import * as ReactDOM from 'react-dom';
|
||||
import { App } from './App';
|
||||
|
||||
ReactDOM.render(<App/>, document.getElementById('app'));
|
||||
// cookieにトークンが入ってたらlocalStorageに移し替える
|
||||
const token = document.cookie
|
||||
.split('; ')
|
||||
.find(row => row.startsWith('token'))
|
||||
?.split('=')[1];
|
||||
|
||||
console.log(document.cookie);
|
||||
console.log(token);
|
||||
|
||||
if (token) {
|
||||
localStorage['token'] = token;
|
||||
// 今の所はcookieをトークン以外に使用しないため全消去する
|
||||
// もしcookieの用途が増えるのであればここを良い感じに書き直す必要がある
|
||||
document.cookie = '';
|
||||
}
|
||||
|
||||
ReactDOM.render(<App/>, document.getElementById('app'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue