Skip to content

Instantly share code, notes, and snippets.

View ryanbelke's full-sized avatar
💭
coding

Ryan Beke ryanbelke

💭
coding
  • Austin, Tx
View GitHub Profile
@ryanbelke
ryanbelke / orders.js
Created May 3, 2020 19:56
/backend/api/order/controllers/order.js
"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);
/* /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";
@ryanbelke
ryanbelke / index.js
Last active May 12, 2020 01:12
cart index.js
/* 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() {
/* /pages/login.js */
import React, { useState, useEffect, useContext } from "react";
import { useRouter } from "next/router";
import {
Container,
Row,
Col,
Button,
Form,
/* /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) => {
/* /pages/register.js */
import React, { useState, useContext } from "react";
import {
Container,
Row,
Col,
Button,
Form,
/* /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
@ryanbelke
ryanbelke / restaurants.js
Last active May 17, 2020 01:20
dish rendering
/* /pages/restaurants.js */
import { useQuery } from "@apollo/react-hooks";
import { useRouter } from "next/router";
import { gql } from "apollo-boost";
import {
Button,
Card,
CardBody,
CardImg,
@ryanbelke
ryanbelke / index.js
Last active May 17, 2020 00:56
RestaurantList Component
/* components/RestaurantList/index.js */
import { useQuery } from "@apollo/react-hooks";
import { gql } from "apollo-boost";
import Link from "next/link";
import {
Card,
CardBody,
CardImg,
@ryanbelke
ryanbelke / _app.js
Last active May 3, 2020 23:49
_app.js without Container component
/* _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 (
<>