forked from osdio/noder-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
30 lines (24 loc) · 644 Bytes
/
utils.js
File metadata and controls
30 lines (24 loc) · 644 Bytes
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
import {createAction} from 'redux-actions';
import * as types from '../constants/ActionTypes';
import * as storageService from '../services/storage';
const syncReducer = ['user', 'message', 'topic'];
export const toast = createAction(types.TOAST, (text, timeout)=> {
return {
text,
timeout,
id: new Date().getTime()
}
});
export const getReducerFromAsyncStorage = createAction(types.GET_REDUCER_FROM_ASYNC_STORAGE, async()=> {
return storageService.multiGet(syncReducer)
.then(arr=> {
let ob = {};
arr.forEach(item=> {
ob[item[0]] = item[1];
});
return ob;
})
.catch(err=> {
console.warn(err);
});
});