Skip to content

Commit cba434c

Browse files
committed
module refactor
1 parent f397e90 commit cba434c

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

actions/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { GET_TOKEN } from '../reducers/constants'
2+
3+
export function getToken() {
4+
return {
5+
type: GET_TOKEN,
6+
payload: {
7+
request: {
8+
url: `/auth`
9+
}
10+
}
11+
};
12+
}

reducers/constants.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const GET_TOKEN = 'GET_TOKEN';
2+
export const GET_TOKEN_SUCCESS = 'GET_TOKEN_SUCCESS';
3+
export const GET_TOKEN_FAIL = 'GET_TOKEN_FAIL';

reducers/index.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
export const GET_TOKEN = 'GET_TOKEN';
2-
export const GET_TOKEN_SUCCESS = 'GET_TOKEN_SUCCESS';
3-
export const GET_TOKEN_FAIL = 'GET_TOKEN_FAIL';
1+
import { GET_TOKEN, GET_TOKEN_SUCCESS, GET_TOKEN_FAIL } from './constants'
42

53
export default function reducer(state = { token: null }, action) {
64
switch (action.type) {
@@ -18,14 +16,3 @@ export default function reducer(state = { token: null }, action) {
1816
return state;
1917
}
2018
}
21-
22-
export function getToken() {
23-
return {
24-
type: GET_TOKEN,
25-
payload: {
26-
request: {
27-
url: `/auth`
28-
}
29-
}
30-
};
31-
}

screens/AutorizationScreen.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import WaterfallImage from '../assets/waterfall.svg'
66
import SvgUri from 'react-native-svg-uri';
77

88
import { connect } from 'react-redux';
9-
import { getToken } from '../reducers';
9+
import { getToken } from '../actions';
1010

1111

1212
const AutorizationScreen = ({ getToken, token, navigation }) => {

0 commit comments

Comments
 (0)