I am using npm concurrently to run front end and backend at the same time, but still not connecting to the backend correctly. The path is generating correctly and works in postman, but not when I call it from the site. I've run it through the debugger, and narrowed it down. I am sure it has something to do with how I have my proxy set up, but I am not sure exactly were I went wrong HELP!
Front end package.json
"proxy": "http://myIPaddress:4001",
"secure": false
action in redux:
import {LOGIN} from './types'
const baseline = `http://myIPaddress/`
export const login = (username, password) => async dispatch => {
console.log('tell me the username', username.value, " and your password? ", password.value)
let path = `postLogin/`
let params = `${username.value}/${password.value}`
console.log('the path : ', `${baseline}${path}${params}`)
try{
// axios.default.header.get['Content-Type'] = ''
let res = await fetch(`${baseline}${path}${params}`,{
method: 'GET',
headers: {
'Content-type': 'application/json'
}
}
)
.then(res => res.json())
.then(
dispatch( {
type: LOGIN,
payload: res.json()
})
)
}
catch(e){
console.log(`can't find that user ${username.value}`)
}
}
If there is a section I did not include you all need in order to help me solve this, please let me know.
THANKS!