This file contains 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
File 1 |
This file contains 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 class EmployeeList extends React.Component { | |
state = { | |
employees: [], | |
isLoading: true | |
} | |
componentDidMount() { | |
if (localStorage.token) { | |
this.loadEmployeesData() | |
} |
This file contains 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
// === Action Creators === | |
export function posItemRequest(itemBody) { | |
return { | |
type: 'ITEM_POST_REQUEST', | |
payload: { | |
itemBody: itemBody | |
} | |
} | |
} |
This file contains 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
function itemsReducer(state, action) { | |
switch(action.type) { | |
case 'UPDATE_ITEM': | |
return state.items.map(i => itemReducer(i, action)) | |
default: | |
return state | |
} | |
} | |
function itemReducer(state, action) { |
This file contains 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 { bindActionCreators } from 'redux' | |
import { connect } from 'react-redux' | |
import Settings from '../components/scenes/settings' | |
import * as settingActions from '../actions/settings' | |
import * as signUpActions from '../actions/sign-up' | |
import * as loginActions from '../actions/login' | |
import * as routerActions from '../actions/router' |
This file contains 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' | |
class AppTemplate extends React.Component { | |
componentWillMount() { | |
this.props.veritfyUserToken() | |
} | |
render() { | |
if (this.props.state.loading) { | |
return ( |
This file contains 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
(defn flatten [nested] | |
(reduce | |
(fn [acc el] | |
(concat acc (if (sequential? el) | |
(flatten el) | |
[el]))) | |
[] | |
nested)) | |
This file contains 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 { percentage } from '../utils.js' | |
// Component goes here. |