Skip to content

Instantly share code, notes, and snippets.

View raphaelspimenta's full-sized avatar

Raphael de Souza Pimenta raphaelspimenta

View GitHub Profile
{
"_beagleType_":"card",
"style": {
"flexDirection":"row"
},
"children":[
{
"_beagleType_":"image",
"url":"https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/small-dog-breeds-havanese-1583342482.jpg",
"description":"Foto do Cãozinho Feliz",
{
"_beagleType_":"text",
"value":"New text comming from BFF"
}
{
"_beagleType_":"card",
"style": {
"flexDirection":"row"
},
"children":[
{
"_beagleType_":"image",
"url":"https://www.petlove.com.br/images/breeds/193436/profile/original/beagle-p.jpg",
"description":"Foto do Cãozinho Bolado",
@raphaelspimenta
raphaelspimenta / resources.js
Created May 24, 2019 17:49
store/resources.js
import { createResource } from '@zup-next/redux-resource'
import { put } from 'redux-saga/effects'
import api from '../api'
const profile = createResource('PROFILE', {
load: api.loadProfile,
update: api.saveProfile,
})
const catalog = createResource('CATALOG', { load: api.loadCatalog })
...
class Payment extends PureComponent {
...
componentWillUnmount() {
const { resetOrderStatus } = this.props
resetOrderStatus()
}
@raphaelspimenta
raphaelspimenta / Sumary.js
Created May 24, 2019 14:15
containers/Payment/components/Summary.js
const Summary = ({ movie, wallet, selectedPaymentMethod, selectPaymentMethod, createOrder }) => (
<Content>
<PageTitle>Order Summary</PageTitle>
<Product>Item: {movie.title}</Product>
<Detail>Order total: ${movie.price}</Detail>
<Detail>Choose a payment method:</Detail>
<PaymentMethodList>
<PaymentMethod
label="Balance"
value={`${wallet.balance}`}
@raphaelspimenta
raphaelspimenta / Payment.js
Last active May 27, 2019 17:16
containers/Payment/index.js
import {
isPristine,
isLoading,
hasLoadError,
isCreating,
hasCreateSuccess,
hasCreateError,
} from '@zup-next/redux-resource'
const findMovieById = (catalog, id) => find(catalog.data, { id: parseInt(id) })