This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {applyMiddleware, createStore} from "redux"; | |
| //middlewares | |
| import logger from "redux-logger"; | |
| import promise from "redux-promise-middleware"; | |
| import thunk from "redux-thunk"; | |
| import reducers from "./reducers"; | |
| const middleware = applyMiddleware(promise(), thunk, logger()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {combineReducers} from "redux"; | |
| import user from "./usersReducer"; | |
| export default combineReducers({ | |
| user | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function reducer(state={ | |
| users:[], | |
| fetching: false, | |
| fetched: false, | |
| error: null | |
| }, action){ | |
| switch (action.type) { | |
| case "FETCH_USERS":{ | |
| return {...state, fetching: true} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios from "axios"; | |
| export function fetchUsers(){ | |
| return function(dispatch){ | |
| axios.get('http://reqres.in/api/users?page=1') | |
| .then((response) =>{ | |
| dispatch({type:'FETCH_USERS_FULFILLED', payload:response.data.data}); | |
| }) | |
| .catch((err) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import {connect} from "react-redux"; | |
| import UserList from './UserList.js' | |
| import {fetchUsers} from "../actions/userActions.js" | |
| @connect((store) => { | |
| // console.log("ins store",store.userReducer.users); | |
| return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import User from './User.js'; | |
| export default class UserList extends React.Component{ | |
| render(){ | |
| if(Object.getOwnPropertyNames(this.props.users).length === 0){ | |
| return (<div></div>) | |
| } | |
| var userNodes = this.props.users.map(function(user){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import ReactDOM from "react-dom" | |
| export default class User extends React.Component{ | |
| render(){ | |
| // console.log("userprops",this.props); | |
| return ( | |
| <div> | |
| <img src={this.props.avatar} className="avatar"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .username { | |
| margin: auto; | |
| color: #658585; | |
| font-size: 1.53em; | |
| font-family: "Coda", sans-serif; | |
| font-weight: bold; | |
| } | |
| .avatar { | |
| padding: .7em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import './App.css'; | |
| /* | |
| Screen:LoginScreen | |
| Loginscreen is the main screen which the user is shown on first visit to page and after | |
| hitting logout | |
| */ | |
| import LoginScreen from './Loginscreen'; | |
| /* | |
| Module:Material-UI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require("fs"); | |
| var path = require('path'); | |
| var writePath = '/home/saurabh/Documents/'; | |
| var cmd=require('node-cmd'); | |
| var async = require('async'); | |
| var jsonfile = require('jsonfile'); | |
| exports.fileupload = function(req,res){ | |
| // console.log("req",req.files); | |
| var filesArray = req.files; |