简体   繁体   中英

Issue with passing data for registration in redux-saga

I have a problem inside redux-saga workflow in registering a single user. This is part of the code for redux-saga:

// Relative imports
import * as ActionTypes from "./constants";
import { signupAPI } from "../../../utils/webAPI";

function* signup(action) {
    try {
      yield call(signupAPI, action.data);
      yield put({ type: ActionTypes.USER_SIGNUP_SUCCESS });
    } catch (error) {
      yield put({ type: ActionTypes.USER_SIGNUP_ERROR, error });
    }
  }

export default [takeLatest(ActionTypes.USER_SIGNUP_REQUESTING, signup)];

This one is an API call to server:

// POST request to create user with email, password, firstName, lastName
export const signupAPI = data => http.post(`${API}/users`, data);

I am using axios and "http" is a configuration of axios. What I want to do: pass data of email, password, name, last name in signupAPI. What I get is this: error image I am not sure what is done wrong.

减速器文件中发现未使用的变量时出错。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM