Skip to content

Instantly share code, notes, and snippets.

rafael-metractive

View GitHub Profile
View murilo-exemplo-saga-user.js
import { call, put, takeEvery, select } from 'redux-saga/effects'
// Services
import { callApi, callServiceApi } from 'services/api'
function* login(action) {
try {
// Set loading state
yield put({
type: 'USER_SET_LOADING',
View murilo-exemplo-redux-user.js
const USER_SET = 'USER_SET'
const USER_SET_LOADING = 'USER_SET_LOADING'
const USER_LOGOUT = 'USER_LOGOUT'
const initialState = {
loading: false,
userData: {}
}
export default function user (state = initialState, action = {}) {
View webpack.config.js
var path = require('path');
const webpack = require('webpack');
module.exports = {
mode: "development",
entry: './src/index.js',
watch: true,
output: {
path: '/xampp7/htdocs/metractive/tagse-frontend/public',
filename: 'bundle.js',
View timeline-mockup.js
import IMAGES from "@constants/images";
const INITIAL_STATE = {
data: [],
first_access_app: true,
car_info: {
km_atual: 10000,
marca: "Toyota",
modelo: "Etios",
versao: "1.5 XS Sedan",
ano: "2016/2016",
View .babelrc
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
[
"module-resolver",
{
"extensions": [
".js",
".ios.js",
".android.js",
View igor-services-api-index.js
import axios from 'axios'
import CONFIGS from '@constants/configs'
export const callApi = (call) => {
let {
title = '',
endpoint,
method = 'GET',
params = null,
View igor-services-config.js
export default {
url: 'http://35.229.117.212:5000/api'
}
View igor-reducers-user.js
const USER_SET = 'USER_SET';
const USER_SET_STATE = 'USER_SET_STATE';
const initialState = {
user: {},
loading: false
};
export default (state = initialState, action = {}) => {
switch (action.type) {
View igor-store.js
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
import { createReactNavigationReduxMiddleware, createNavigationReducer, reduxifyNavigator } from 'react-navigation-redux-helpers';
import { connect } from 'react-redux';
// Middlewares
import createSagaMiddleware from 'redux-saga';
// Saga's
import user from './reducers/sagas/user'
import schedule from './reducers/sagas/schedule'
View igor-index.js
import React from 'react';
import { Dimensions, AsyncStorage } from 'react-native';
import { Provider } from 'react-redux';
import { call, put, takeEvery, select } from 'redux-saga/effects'
// Navigation
import { createStackNavigator, createDrawerNavigator, DrawerActions } from 'react-navigation'
// Get store (redux)
import store from './store'
You can’t perform that action at this time.