Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export function signUpUser(user){
- var data = {email: user.email, password: user.password, password_confirmation: user.password};
- return function(dispatch){
- dispatch({type: 'SIGN_UP_USER'})
- return fetch('https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-2.amazonaws.com:8081/api/users', {
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({user: data}),
- }).then(res => console.log(res))
- .catch(error => console.error('Error:', error))
- .then(response => console.log('Success:', response));
- }
- }
- Failed to load https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-
- 2.amazonaws.com:8081/api/users/sign_in: Response to preflight request
- doesn't pass access control check: No 'Access-Control-Allow-Origin' header
- is present on the requested resource. Origin
- 'https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-
- 2.amazonaws.com' is therefore not allowed access. The response had HTTP
- status code 499. If an opaque response serves your needs, set the request's
- mode to 'no-cors' to fetch the resource with CORS disabled.
- Rails.application.config.middleware.insert_before 0, Rack::Cors do
- allow do
- origins 'https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-
- 2.amazonaws.com'
- resource '*',
- headers: :any,
- methods: %i(get post put patch delete options head)
- end
- end
Add Comment
Please, Sign In to add comment