@@ -28,11 +28,6 @@ const Mutation = {
},
info
)
- const token = jwt.sign({ userId: user.id }, process.env.APP_SECRET)
- context.response.cookie('token', token, {
- httpOnly: true,
- maxAge: 7 * 24 * 3600 * 1000
- })
return user
signup: async (parent, args, ctx, info) => {
@@ -1,25 +1,51 @@
import React from 'react'
import Link from 'next/link'
+import { UserNav } from '../components/user'
+
const Nav = () => (
- <nav>
- <ul>
- <li>
- <Link href='/'>
- <a>Home</a>
- </Link>
- <Link href='/archive'>
- <a>Archive</a>
- <Link href='/exercises'>
- <a>Exercises</a>
- <Link href='/polls'>
- <a>Polls</a>
- </li>
- </ul>
- </nav>
+ <>
+ <nav>
+ <ul>
+ <li>
+ <Link href='/'>
+ <a>Home</a>
+ </Link>
+ </li>
+ <Link href='/archive'>
+ <a>Archive</a>
+ <Link href='/exercises'>
+ <a>Exercises</a>
+ <Link href='/polls'>
+ <a>Polls</a>
+ <UserNav />
+ </ul>
+ </nav>
+ <style jsx>
+ {`
+ ul {
+ padding: 0 0.5em;
+ }
+ li {
+ display: inline;
+ margin: 0 0.5em;
+ `}
+ </style>
+ </>
export default Nav
@@ -0,0 +1,17 @@
+import { Mutation } from 'react-apollo'
+import Link from 'next/link'
+import { USER_LOGIN } from '../lib/graphql'
+const UserLoginForm = props => <p>Login Form</p>
+const UserNav = props => (
+ <Link href='user'>
+ <a>test</a>
+)
+const User = props => <a />
+export { UserNav }
+export default User
@@ -0,0 +1,30 @@
+import { mutation } from 'react-apollo'
+import gql from 'graphql-tag'
+const USER_LOGIN = gql`
+ mutation USER_LOGIN($email: String!, $password: String!) {
+ login(email: $email, password: $password) {
+ id
+ email
+ name
+`
+const USER_LOGOUT = gql`
+ mutation USER_LOGOUT {
+ logout {
+const USER_SIGNUP = gql`
+ mutation USER_SIGNUP($email: String!, $password: String!, $name: String!) {
+ signup(email: $email, password: $password, name: $name) {
+export { USER_LOGIN, USER_LOGOUT, USER_SIGNUP }
@@ -0,0 +1,9 @@
+import User from '../components/user'
+const UserPage = props => (
+ <section>
+ <p>This is the user page.</p>
+ </section>
+export default UserPage