This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /pages/signin.js */ | |
import React, { useState, useEffect } from "react"; | |
import Router from "next/router"; | |
import { | |
Container, | |
Row, | |
Col, | |
Button, | |
Form, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /pages/signup.js */ | |
import React, { useState } from "react"; | |
import { | |
Container, | |
Row, | |
Col, | |
Button, | |
Form, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /components/Layout.js */ | |
import React from "react"; | |
import Head from "next/head"; | |
import Link from "next/link"; | |
import { Container, Nav, NavItem } from "reactstrap"; | |
//import HOC withAuthSync and logout method | |
//wrap page in withAuthSync to access token and user props | |
import { logout } from "../lib/auth"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /lib/auth.js */ | |
import { useEffect } from "react"; | |
import Router from "next/router"; | |
import Cookie from "js-cookie"; | |
import axios from "axios"; | |
const API_URL = process.env.API_URL || "http://localhost:1337"; | |
//register a new user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /pages/restaurants.js */ | |
import { useQuery } from "@apollo/react-hooks"; | |
import { useRouter } from "next/router"; | |
import { gql } from "apollo-boost"; | |
import withData from "../lib/apollo"; | |
import { | |
Button, | |
Card, | |
CardBody, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /pages/index.js */ | |
import React, { useState } from "react"; | |
import { Col, Input, InputGroup, InputGroupAddon, Row } from "reactstrap"; | |
import RestaurantList from "../components/RestaurantList"; | |
function Home() { | |
const [query, updateQuery] = useState(""); | |
return ( | |
<div className="container-fluid"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* components/RestaurantList/index.js */ | |
import { useQuery } from "@apollo/react-hooks"; | |
import { gql } from "apollo-boost"; | |
import Link from "next/link"; | |
import { | |
Card, | |
CardBody, | |
CardImg, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* server.js */ | |
const express = require("express"); | |
const next = require("next"); | |
const dev = process.env.NODE_ENV !== "production"; | |
const app = next({ dev }); | |
const handle = app.getRequestHandler(); | |
app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Card | |
style={{ width: "30%", margin: "0 10px" }} | |
className="h-100" | |
key={res._id} | |
> | |
<CardImg | |
top={true} | |
style={{ height: 250 }} | |
src={res.image.url} | |
/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /pages/index.js */ | |
import RestaurantList from "../components/RestaurantList"; | |
import React from "react"; | |
import defaultPage from "../hocs/defaultPage"; | |
import { | |
Alert, | |
Button, | |
Col, | |
Input, |