Skip to content

Instantly share code, notes, and snippets.

View igorfelipee's full-sized avatar
💻
Creating awesome webapps

Igor Felipe igorfelipee

💻
Creating awesome webapps
View GitHub Profile
import React, { Component } from 'react';
import './RepoDetails.css';
import $ from 'jquery';
export default class RepoDetails extends Component{
constructor(){
super();
this.state = {repo: {}, commits: []};
this.getCommits = this.getCommits.bind(this);
}
import { mapActions } from 'vuex';
export default {
name: 'book',
methods: {
...mapActions([
addItemToCart: 'addItemToCart'
])
},
props:['book']
}
function save_data(data, id) {
if (!window.localStorage || !window.JSON || !id) {
return;
}
window.localStorage.setItem(id, JSON.stringify(data));
}
function get_data(key) {
@igorfelipee
igorfelipee / runValidationIfFieldExists.js
Created January 11, 2019 18:31
runValidationIfFieldExists
export const runValidationIfFieldExists = validationFunction => (objectPath, object) => {
const NOT_FOUND_PATH_IN_OBJECT = null;
const checkIfObjectPathExistis = pathOr(NOT_FOUND_PATH_IN_OBJECT, objectPath, object);
return checkIfObjectPathExistis ? validationFunction(checkIfObjectPathExistis) : '';
};
// Chamada para criar sessão no BFF com carrinho que tenha desconto
{
idUsuario: '1234',
idCarrinho: '4567',
opcaoDeFrete: 'A_JATO'
}
// Responsta de criação de sessão
{
sessionMeta:{
idUsuario: '1234',
// Chamada para criar sessão no BFF com carrinho que não tenha desconto
{
idUsuario: '1234',
idCarrinho: '7890',
opcaoDeFrete: 'A_JATO'
}
// Responsta de criação de sessão
{
sessionMeta:{
idUsuario: '1234',
// Chamada para o BFF - *MUDAR_FRETE*
sessionMeta:{
idUsuario: '1234',
idCarrinho: '4567',
opcaoDeFrete: 'A_JATO'
},
payload: {
opcaoDeFreteSelecionada: 'MAIS_BARATO'
},
type: 'MUDAR_FRETE'
// Responsta do BFF - *MUDAR_FRETE*
{
sessionMeta:{
idUsuario: '1234',
idCarrinho: '4567',
opcaoDeFrete: 'MAIS_BARATO'
},
components: [
{
rel: 'sumario',
<div
data-ng-if="
(cache.freightOptions.LASA &&
cache.customerPrimeInfoStatus !== 'ASSINANTE') &&
(cache.togglePrimePricing && cache.shouldShowPrimeOffer) ||
cache.shouldDisplayPrimeInfoOnApp">
<p>{{::'freight.prime.alertMessage_01' | translate}}</p>
</div>
type PrimeAlertMessageProps = {
payload: {
mensagem: string
},
behaviour: 'VISIVEL' | 'DESABILITADO'
}
const PrimeAlertMessage: React.FC<PrimeAlertMessageProps> = ({payload, behaviour}) => {
switch(behaviour) {
case 'VISIVEL':
return <p>{payload.mensagem}</p>