File tree Expand file tree Collapse file tree 5 files changed +39
-9
lines changed Expand file tree Collapse file tree 5 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 44 "build" : " next build" ,
55 "start" : " next start" ,
66 "eslint" : " eslint --fix src/**/*" ,
7- "types:generate" : " apollo codegen:generate --target typescript --excludes=node_modules/* --includes=**/*.tsx --endpoint http://localhost:1338/graphql --tagName=gql --outputFlat src/generatedTypes --passthroughCustomScalars --customScalarsPrefix Restaurants" ,
7+ "types:generate" : " apollo codegen:generate --target typescript --excludes=node_modules/* --includes=**/*.tsx --endpoint http://localhost:1338/graphql --tagName=gql --outputFlat src/generatedTypes --passthroughCustomScalars --customScalarsPrefix Restaurants" ,
88 "schema:download" : " apollo schema:download --endpoint http://localhost:1338/graphql"
99 },
1010 "dependencies" : {
1111 "@apollo/client" : " ^3.1.4" ,
12+ "@types/js-cookie" : " ^2.2.6" ,
1213 "axios" : " ^0.20.0" ,
1314 "bootstrap" : " ^4.5.2" ,
1415 "graphql" : " ^15.3.0" ,
Original file line number Diff line number Diff line change 1+ import { createContext } from 'react' ;
2+
3+ const AppContext = createContext ( { isAuthenticated : false } ) ;
4+
5+ export default AppContext ;
Original file line number Diff line number Diff line change @@ -7,7 +7,12 @@ const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:1338/graphq
77
88console . log ( API_URL ) ;
99
10- export const Login = ( ) => { } ;
10+ export const Login = ( ) => {
11+ if ( typeof window === 'undefined' ) {
12+ console . log ( 'Server login!' ) ;
13+ }
14+ return 'Logging in ...' ;
15+ } ;
1116
1217export const Register = ( ) => { } ;
1318
Original file line number Diff line number Diff line change @@ -4,22 +4,36 @@ import type { AppProps /* , AppContext */ } from 'next/app';
44
55import Head from 'next/head' ;
66import { ApolloProvider } from '@apollo/client' ;
7+ import Cookie from 'js-cookie' ;
8+ import fetch from 'axios' ;
79
10+ import AppContext from '../context/AppContext' ;
811import client from '../lib/Apollo' ;
912import Header from '../components/Layout/header' ;
1013import Footer from '../components/Layout/footer' ;
1114
1215import 'bootstrap/dist/css/bootstrap.min.css' ;
1316
1417const App = ( { Component } : AppProps ) => (
15- < div >
16- < Head > < title > Food ordering fullstack application with NextJS and Strapi</ title > </ Head >
17- < Header />
18- < ApolloProvider client = { client } >
19- < Component />
20- </ ApolloProvider >
18+ < >
19+ < Head >
20+ < title > Food ordering fullstack application with NextJS and Strapi</ title >
21+ </ Head >
22+ < AppContext . Provider
23+ value = { {
24+ user : 'no-user' ,
25+ // isAuthenticated: !!this.state.user,
26+ isAuthenticated : false ,
27+ // setUser: this.setUser,
28+ } }
29+ >
30+ < Header />
31+ < ApolloProvider client = { client } >
32+ < Component />
33+ </ ApolloProvider >
34+ </ AppContext . Provider >
2135 < Footer />
22- </ div >
36+ </ >
2337) ;
2438
2539export default App ;
Original file line number Diff line number Diff line change 13641364 resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.34.tgz#05e4f79f465c2007884374d4795452f995720bbe"
13651365 integrity sha512-lYUtmJ9BqUN688fGY1U1HZoWT1/Jrmgigx2loq4ZcJpICECm/Om3V314BxdzypO0u5PORKGMM6x0OXaljV1YFg==
13661366
1367+ " @types/js-cookie@^2.2.6 " :
1368+ version "2.2.6"
1369+ resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.6.tgz#f1a1cb35aff47bc5cfb05cb0c441ca91e914c26f"
1370+ integrity sha512-+oY0FDTO2GYKEV0YPvSshGq9t7YozVkgvXLty7zogQNuCxBhT9/3INX9Q7H1aRZ4SUDRXAKlJuA4EA5nTt7SNw==
1371+
13671372" @types/json-schema@^7.0.3" , "@types/json-schema@^7.0.5":
13681373 version "7.0.6"
13691374 resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0"
You can’t perform that action at this time.
0 commit comments