Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const regStart = phoneNumber => {
- return dispatch => {
- dispatch({ type: REG_START });
- generatekeys()
- .then(pubKey => {
- const body = {
- Phone: phoneNumber,
- PublicKey: pubKey
- };
- return request(`${Constants.baseUrl}Register/SendSMS`, body);
- })
- .then(result => {
- LOG('fetch: ' + JSON.stringify(result));
- if (result.status === 200) {
- console.log('fetch: success, name = ' + result.name);
- dispatch({
- type: REG_SUCCESS,
- payload: {
- result: JSON.parse(result._bodyInit)
- }
- });
- } else {
- dispatch({
- type: REG_ERROR,
- payload: `Failed to login with ${result.status}`
- });
- }
- })
- .catch(error => {
- dispatch({
- type: REG_ERROR,
- payload: `Failed to login with ${error}`
- });
- })
- .done();
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement