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
"use strict"; | |
/** | |
* Order.js controller | |
* | |
* @description: A set of functions called "actions" for managing `Order`. | |
*/ | |
// INSERT STRIPE SECRET TEST KEY FROM YOUR STIPE DASHBOARD | |
// STRIPE.COM -> TEST DATA -> DEVELOPERS | |
const stripe = require("stripe")("INSERT YOUR STRIPE SECRET KEY HERE); |
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 { useContext } from "react"; | |
import { useQuery } from "@apollo/react-hooks"; | |
import { useRouter } from "next/router"; | |
import { gql } from "apollo-boost"; | |
import Cart from "../components/cart/"; | |
import AppContext from "../context/AppContext"; |
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/cart/index.js */ | |
import React, { useContext } from "react"; | |
import Link from "next/link"; | |
import { useRouter } from "next/router"; | |
import { Button, Card, CardBody, CardTitle, Badge } from "reactstrap"; | |
import AppContext from "../../context/AppContext"; | |
function Cart() { |
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/login.js */ | |
import React, { useState, useEffect, useContext } from "react"; | |
import { useRouter } 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
/* /components/Layout.js */ | |
import React, { useContext } from "react"; | |
import Head from "next/head"; | |
import Link from "next/link"; | |
import { Container, Nav, NavItem } from "reactstrap"; | |
import { logout } from "../lib/auth"; | |
import AuthContext from "../context/appContext"; | |
const Layout = (props) => { |
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/register.js */ | |
import React, { useState, useContext } 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
/* /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.NEXT_PUBLIC_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 { | |
Button, | |
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
/* 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
/* _app.js */ | |
import React from "react"; | |
import App from "next/app"; | |
import Head from "next/head"; | |
export default class MyApp extends App { | |
render() { | |
const { Component, pageProps } = this.props; | |
return ( | |
<> |