mirror of
https://github.com/wassname/talk.git
synced 2026-07-26 13:37:38 +08:00
23 lines
724 B
JavaScript
23 lines
724 B
JavaScript
import {base, handleResp, getInit} from '../helpers/response';
|
|
import * as actions from '../constants/embedStream';
|
|
|
|
export const changeTab = activeTab => dispatch =>
|
|
dispatch({
|
|
type: actions.CHANGE_TAB,
|
|
activeTab
|
|
});
|
|
|
|
const userBioRequest = () => ({type: actions.FETCH_USER_BIO_REQUEST});
|
|
const userBioSuccess = userBio => ({type: actions.FETCH_USER_BIO_SUCCESS, userBio});
|
|
const userBioFailure = error => ({type: actions.FETCH_USER_BIO_FAILURE, error});
|
|
|
|
export const fetchUserBio = () => dispatch => {
|
|
dispatch(userBioRequest());
|
|
fetch(`${base}/bio`, getInit('GET'))
|
|
.then(handleResp)
|
|
.then(({bio}) => {
|
|
dispatch(userBioSuccess(bio));
|
|
})
|
|
.catch(() => dispatch(userBioFailure()));
|
|
};
|