Guest User

Untitled

a guest
Feb 13th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. export function signUpUser(user){
  2. var data = {email: user.email, password: user.password, password_confirmation: user.password};
  3. return function(dispatch){
  4. dispatch({type: 'SIGN_UP_USER'})
  5. return fetch('https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-2.amazonaws.com:8081/api/users', {
  6. method: 'POST',
  7. headers: {
  8. 'Accept': 'application/json',
  9. 'Content-Type': 'application/json'
  10. },
  11. body: JSON.stringify({user: data}),
  12. }).then(res => console.log(res))
  13. .catch(error => console.error('Error:', error))
  14. .then(response => console.log('Success:', response));
  15. }
  16. }
  17.  
  18. Failed to load https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-
  19. 2.amazonaws.com:8081/api/users/sign_in: Response to preflight request
  20. doesn't pass access control check: No 'Access-Control-Allow-Origin' header
  21. is present on the requested resource. Origin
  22. 'https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-
  23. 2.amazonaws.com' is therefore not allowed access. The response had HTTP
  24. status code 499. If an opaque response serves your needs, set the request's
  25. mode to 'no-cors' to fetch the resource with CORS disabled.
  26.  
  27. Rails.application.config.middleware.insert_before 0, Rack::Cors do
  28. allow do
  29. origins 'https://ee55715a523f4af8bae9f5467daf644d.vfs.cloud9.us-east-
  30. 2.amazonaws.com'
  31.  
  32. resource '*',
  33. headers: :any,
  34. methods: %i(get post put patch delete options head)
  35. end
  36. end
Add Comment
Please, Sign In to add comment