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
<CardImg | |
top={true} | |
style={{ height: 250 }} | |
src={ process.env.NODE_ENV === "production" | |
? res.image.url : `${process.env.NEXT_PUBLIC_API_URL}${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/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"; | |
import { |
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
async function submitOrder() { | |
// event.preventDefault(); | |
// // Use elements.getElement to get a reference to the mounted Element. | |
const cardElement = elements.getElement(CardElement); | |
// // Pass the Element directly to other Stripe.js methods: | |
// // e.g. createToken - https://stripe.com/docs/js/tokens_sources/create_token?type=cardElement | |
// get token back from stripe to process credit card | |
const token = await stripe.createToken(cardElement); |
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`. | |
*/ | |
const stripe = require("stripe")("YOUR STRIPE SECRET KEY"); |
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/Checkout/cardsection.js */ | |
import React from "react"; | |
import { CardElement } from "@stripe/react-stripe-js"; | |
function CardSection(props) { | |
return ( | |
<div> | |
<div> |
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/Checkout/CheckoutForm.js */ | |
import React, { useState, useContext } from "react"; | |
import { FormGroup, Label, Input } from "reactstrap"; | |
import fetch from "isomorphic-fetch"; | |
import Cookies from "js-cookie"; | |
import { CardElement, useStripe, useElements } from "@stripe/react-stripe-js"; |
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/checkout.js */ | |
import React, { useContext } from "react"; | |
import { Row, Col } from "reactstrap"; | |
import { loadStripe } from "@stripe/stripe-js"; | |
import { Elements } from "@stripe/react-stripe-js"; | |
import InjectedCheckoutForm from "../components/checkout/CheckoutForm"; | |
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
/* _app.js */ | |
import React from "react"; | |
import App from "next/app"; | |
import Head from "next/head"; | |
import Cookie from "js-cookie"; | |
import fetch from "isomorphic-fetch"; | |
import Layout from "../components/Layout"; | |
import AppContext from "../context/AppContext"; | |
import withData from "../lib/apollo"; | |
class MyApp extends 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
/* /pages/register.js */ | |
import React, { useState, useContext } from "react"; | |
import { | |
Container, | |
Row, | |
Col, | |
Button, | |
Form, |
NewerOlder