with cookie auth latest (#10005)

This commit is contained in:
takehiro 2020-01-09 23:50:33 +09:00 committed by Luis Alvarez D
parent abc0b07102
commit 95c2e57e77
4 changed files with 11 additions and 11 deletions

View file

@ -1,7 +1,7 @@
import Link from 'next/link'
import { logout } from '../utils/auth'
const Header = props => (
const Header = () => (
<header>
<nav>
<ul>

View file

@ -3,7 +3,7 @@ import Head from 'next/head'
import Header from './header'
const Layout = props => (
<React.Fragment>
<>
<Head>
<title>With Cookies</title>
</Head>
@ -34,7 +34,7 @@ const Layout = props => (
<main>
<div className="container">{props.children}</div>
</main>
</React.Fragment>
</>
)
export default Layout

View file

@ -6,11 +6,11 @@
"start": "next start"
},
"dependencies": {
"isomorphic-unfetch": "^3.0.0",
"js-cookie": "^2.2.0",
"next": "^9.0.1",
"next-cookies": "^1.0.4",
"react": "^16.8.6",
"react-dom": "^16.8.6"
"isomorphic-unfetch": "latest",
"js-cookie": "latest",
"next": "latest",
"next-cookies": "latest",
"react": "latest",
"react-dom": "latest"
}
}

View file

@ -3,10 +3,10 @@ import fetch from 'isomorphic-unfetch'
import Layout from '../components/layout'
import { login } from '../utils/auth'
function Login() {
const Login = () => {
const [userData, setUserData] = useState({ username: '', error: '' })
async function handleSubmit(event) {
const handleSubmit = async event => {
event.preventDefault()
setUserData(Object.assign({}, userData, { error: '' }))