I want to send argument for redux action in js , but API developer used numeric name value in API section ( 2fa_code ) now I try to send argument to API i give an error ( An identifier or keyword cannot immediately follow a numeric literal. ) . please help me how can I solve this problem .
export const setTwofaGoogle = ({ 2fa_code }) => (dispatch) => {
const token = localStorage.getItem("token");
// Headers
const config = {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
};
// Request body
const body = {
2fa_code
};
axios
.post(TWO_FA_CODE_CONFIRM_URL, body, config)
.then((res) =>
dispatch({
type: SET_2FA_METHOD_GOOGLE_SEUCCES,
payload: res.data,
})
)
.catch((err) => {
dispatch({
type: SET_2FA_METHOD_GOOGLE_FAIL,
payload: err.data,
});
console.log(err);
});
};
error in react
Failed to compile
./src/redux/actions/settingActions.js
Line 47:14: Parsing error: Identifier 'setTwofaGoogle' has already been declared
45 | /* -------------------------- 2fa Code Confirm -------------------------- */
46 |
> 47 | export const setTwofaGoogle = ({ 2fa_code }) => (dispatch) => {
| ^
48 | const token = localStorage.getItem("token");
49 | // Headers
50 | const config = {
This error occurred during the build time and cannot be dismissed.