Skip to content

Instantly share code, notes, and snippets.

View AlbionaHoti's full-sized avatar
💎

albicodes AlbionaHoti

💎
View GitHub Profile
@AlbionaHoti
AlbionaHoti / payment_intents.js
Created October 11, 2020 22:37
webiny-starter-e-commerce-nextjs-stripe
import Stripe from 'stripe'
const stripe = new Stripe(
'STRIPE_SECRET_KEY_HERE'
)
export default async (req, res) => {
if (req.method === 'POST') {
try {
const { amount, paymentIntentId } = JSON.parse(req.body)
@AlbionaHoti
AlbionaHoti / _app.js
Last active October 20, 2020 22:02
e-commerce-starter
import '../assets/antd-custom.less';
// Layout Component
import LayoutComponent from '../components/Layout';
// React Context
import { CartProvider } from '../context/Context';
// Apollo
import { ApolloProvider } from '@apollo/client';
import { useApollo } from '../lib/apolloClient';
@AlbionaHoti
AlbionaHoti / apolloClient.js
Last active October 15, 2020 00:05
e-commerce-starter
import { useMemo } from 'react'
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
let apolloClient
function createApolloClient() {
return new ApolloClient({
ssrMode: typeof window === 'undefined',
link: new HttpLink({
uri: process.env.CONTENT_DELIVERY_API_URL,
@AlbionaHoti
AlbionaHoti / ProductList.js
Last active October 30, 2020 20:26
e-commerce-starter
// Apollo
import { useQuery, gql } from '@apollo/client';
// Ant design
import { Row, Col } from 'antd';
// Components
import ProductCard from './Product';
export const QUERY = gql`
@AlbionaHoti
AlbionaHoti / CheckoutForm.js
Last active October 30, 2020 22:53
e-commerce-starter
// Ant design
import { Button, Form } from 'antd';
// React context
import { CartContext, TotalContext } from '../context/Context';
import { Col, Row } from 'antd';
import React, { useContext, useState } from 'react';
// Components
import { BillingDetailsFields } from './BillingDetailsField';
// styled components
@AlbionaHoti
AlbionaHoti / Layout2.js
Created October 15, 2020 19:38
e-commerce-starter
import React, { useState } from 'react';
// Ant Design
import { Layout } from 'antd';
const { Content, Footer } = Layout;
// Header
import HeaderComponent from './Header';
// Stripe

Keybase proof

I hereby claim:

  • I am albionahoti on github.
  • I am hoti5 (https://keybase.io/hoti5) on keybase.
  • I have a public key ASDAS744Bw6WJc4SwzRdgtY6kEEAagIkWvRuBO1kPcZqzQo

To claim this, I am signing this object: