location.js
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
export const initialState = {
startLocation: null,
finishLocation: null,
settingLocation: false,
info: '',
};
export const SET_LOC_REQUEST = 'SET_LOC_REQUEST';
export const SET_LOC_SUCCESS = 'SET_LOC_SUCCESS';
export const SET_LOC_FAILURE = 'SET_LOC_FAILURE';
export default (state = initialState, action) => {
switch (action.type) {
case SET_LOC_REQUEST: {
return {
...state,
settingLocation: true,
}
}
case SET_LOC_SUCCESS: {
const {startLocation, finishLocation} = action.data;
return {
...state,
startLocation,
finishLocation,
isLoggingIn: false,
};
}
case SET_LOC_FAILURE: {
const {info} = action.data;
return {
...state,
settingLocation: false,
info,
}
}
default: {
return {
...state,
};
}
}
};