Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {createStore, applyMiddleware} from 'redux';
- import Reducers from './Reducer'
- import thunk from 'redux-thunk'
- export default SettingStore = () => {
- let store = createStore(Reducers, applyMiddleware(thunk))
- return store
- }
- import {combineReducers} from 'redux';
- import loginreducer from './login.reducer'
- export default combineReducers({
- login: loginreducer,
- })
- import {FETCHING_GETDATA_PARVU} from '../Constante'
- import {GetParv} from '../Api/Parvularia.api'
- export const getParvuSuccess = (data) => {
- return {type: FETCHING_GETDATA_PARVU, data}
- }
- export const GetParvu = () => {
- return (dispatch) => {
- dispatch(getData())
- GetParv(1)
- .then(([response, json]) => {
- dispatch(getParvuSuccess(json))
- })
- .catch((error) => console.log(error))
- }
- }
- import {FETCHING_GETDATA_PARVU} from '../Constante'
- const initialState = {
- data: [],
- isFeching: false,
- error: false
- }
- export default dataReducer = (state = initialState, action) => {
- switch(action.type) {
- case FETCHING_GETDATA_PARVU:
- return {
- ...state,
- data: action.data,
- isFeching: false
- }
- default:
- return state
- }
- }
- import React, { Component } from 'react';
- import { Platform, StyleSheet, Text, View } from 'react-native';
- import {Provider} from 'react-redux';
- import Lista from '../screens/Educadora/Lista';
- import SettingStore from './SettingStore'
- let store = SettingStore()
- const Ap = () => (
- <Provider store={store}>
- <Lista/>
- </Provider>
- )
- export default Ap;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement