繁体   English   中英

Angular $ http在Rails Devise上更改url

[英]Angular $http changing url on Rails Devise

这是我有史以来第一个堆栈溢出问题,因为Google通常会将我分类。 但是,我似乎找不到任何东西/任何人在线复制我的问题。

我正在使用Angular Devise模块,当我尝试使用以下URL登录时

test.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json

$ http或Devise将其更改为

http:// undefined:undefinedtest.aam.tunnel.logicsaas-development.com:3000 / users / sign_in.json

这是我的配置代码:

AuthInterceptProvider.interceptAuth(true);

AuthProvider.loginPath('test.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json');
AuthProvider.loginMethod('POST');
AuthProvider.resourceName('users');

和我的登录电话:

var credentials = {
    email: 'user@domain.com',
    password: 'password1'
};

Auth.login(credentials).then(function(user) {
    console.log(user); // => {id: 1, ect: '...'}
}, function(error) {
    console.log(error)
    // Authentication failed...
});

我进行了研究,并且99%的人确信$ http会发生这种情况。 任何帮助将不胜感激

也许您必须使用以下方式更改主机配置:

 .config(function(AuthProvider){ AuthProvider.baseUrl("http://test.aam.tunnel.logicsaas-development.com:3000"); }) 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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