Skip to content

Commit 33868dc

Browse files
committed
remove unnecessary boilerplate
1 parent e76730f commit 33868dc

File tree

4 files changed

+1
-62
lines changed

4 files changed

+1
-62
lines changed

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ server.use('/', express.static(__dirname + '/build'));
2424

2525
function notify(res, to) {
2626
var key = 'AAAAaxzCIxA:APA91bEjujdjrAqHhPb9MWtEpaMCKxa0i--K4KPfR5dtXqkhlmbtLOqm705_-NJ6kUOYqRwOBvurJId9yyr2UNkClgltWARrjYlcByXGE5wjaIMdBNZLf8irwiubOej79v461wnHJrM78LoZkRyLW4Wp2cNRYS1Vcg';
27-
to = "f1WEClQziU4:APA91bENUyx_79nE1c8lEXnHfzu38SlkqIF0c0FrrHw58SR0byKRrf3WNhU_h82QkOMexLKOaJfakGsh7cDViKGD39RpP-1I_TZfsLyANKo1qRp5pT68L8wN-QlxXPnvZFksUh7kqbqY";
27+
to = "e8wUWuFtJyk:APA91bFxS-kINo7WK_3Um4rTPGlSKacZv4jUBhOy637yA4XrRR9pqQpLG9fD3gmZGULXiQNbvCz2DNlM4bICF6TqIXbg-SjgLONCCoYSTGM0kfYjvzA6aWAbOOCP1NC0O593dTQsAWQ1";
2828
var notification = {
2929
'title': 'Wow! This works like a charm.',
3030
'body': 'What sorcery is this?',

src/actions/users.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
11
import axios from 'axios';
22

3-
export const INCREMENT_USERS = "INCREMENT_USERS";
4-
export const DECREMENT_USERS = "DECREMENT_USERS";
5-
export const SET_USERS = "SET_USERS";
63
export const NOTIFICATION_SENT = "NOTIFICATION_SENT";
74

8-
export function incrementUsersAction() {
9-
return {
10-
type: INCREMENT_USERS
11-
};
12-
}
13-
14-
export function decrementUsersAction() {
15-
return {
16-
type: DECREMENT_USERS
17-
};
18-
}
19-
20-
export function setUsers(count) {
21-
return {
22-
type: SET_USERS,
23-
count
24-
};
25-
}
26-
275
export function notificationSentStatusAction(status) {
286
return {
297
type: NOTIFICATION_SENT,

src/containers/home/Home.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import React, {Component} from "react";
22
import {connect} from "react-redux";
33
import Users from '../../components/user/Users';
44
import {
5-
incrementUsersAction,
6-
decrementUsersAction,
7-
setUsers,
85
notifyMeAction,
96
notifyMeWithDelayAction
107
} from "../../actions/users";
@@ -15,28 +12,10 @@ class Home extends Component {
1512

1613
constructor() {
1714
super();
18-
this.incrementUsers = this.incrementUsers.bind(this);
19-
this.decrementUsers = this.decrementUsers.bind(this);
20-
this.setUsers = this.setUsers.bind(this);
2115
this.notifyMe = this.notifyMe.bind(this);
2216
this.notifyMeWithDelay = this.notifyMeWithDelay.bind(this);
2317
}
2418

25-
incrementUsers() {
26-
const { dispatch } = this.props;
27-
dispatch(incrementUsersAction());
28-
}
29-
30-
decrementUsers() {
31-
const { dispatch } = this.props;
32-
dispatch(decrementUsersAction());
33-
}
34-
35-
setUsers() {
36-
const { dispatch } = this.props;
37-
dispatch(setUsers(394));
38-
}
39-
4019
notifyMe(){
4120
const { dispatch } = this.props;
4221
dispatch(notifyMeAction("cVE7cjmnmSU:APA91bHAnuvYp_0wbHIA5BaA6z6E_DaLLUDstnKfTU7RlKykAFLJWQdyDF2iV2gtZygmPnuYox0dwgLgjQlnqNBfz9IW2JTXip5Ms6ui44Vq9sao_0YPnxaxdPgtZ5dXrjRxhxRo50vB"));
@@ -51,9 +30,6 @@ class Home extends Component {
5130
return (
5231
<div>
5332
<Users users={this.props.users}/>
54-
<button onClick={()=>this.incrementUsers()}>INCREMENT</button>
55-
<button onClick={()=>this.decrementUsers()}>DECREMENT</button>
56-
<button onClick={()=>this.setUsers()}>Turn to 394!</button>
5733
<button onClick={()=>this.notifyMe()}>Notify me!</button>
5834
<button onClick={()=>this.notifyMeWithDelay()}>Notify me with delay!</button>
5935
</div>

src/reducers/users.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
import {
2-
INCREMENT_USERS,
3-
DECREMENT_USERS,
4-
SET_USERS
52
} from "../actions/users";
63

74
export function users(state = {
85
count: 0,
96
type: 'none'
107
}, action) {
118
switch (action.type) {
12-
case INCREMENT_USERS:
13-
return Object.assign({}, state, {
14-
count: ++state.count
15-
});
16-
case DECREMENT_USERS:
17-
return Object.assign({}, state, {
18-
count: --state.count
19-
});
20-
case SET_USERS:
21-
return Object.assign({}, state, {
22-
count: action.count
23-
});
249
default:
2510
return state;
2611
}

0 commit comments

Comments
 (0)