Bir angularjs proje üzerinde çalışıyorum ve web'e oldukça yeni. Ne elde etmek çalışıyorum basit bir giriştir. Sunucu tarafındaki (nodejs) ve ayrıca müşteri tarafında, jeton temel kimlik uygulanan.
Her şey harika çalışıyor gibi görünüyor. i çalıştığınızda hariç
Bu. $ window.location.href
Benim kimlik doğrulama düzgün çalışıp çalışmadığını test etmek için, giriş tıkladığımızda, mükemmel çalışır yetkili bitiş noktasına bir $ http.get çağrıda bulundular. Sonra nodejs (hizmet) yapılan bir çağrı onay göstergesi başlığını ihtiyacı belirli bir son nokta, bana bir sayfa hizmet etmek istiyorum. Ama onun gönderiliyor değil.
public loginClick = () => {
this.authService.login(this.user).then(msg => {
console.log(success);
this.$http.get(Config.apiEndpoint().url + '/memberinfo').then(result => {
console.log(result.data); //<== this works
var landingUrl = http:// + this.$window.location.host + /dashboard/;
this.$window.location.href = landingUrl; //<== this does not works
});
}, errMsg => {
console.log(failes);
});
}
nodejs kodu
app.get('/', moduleRoutes.root);
app.get('/dashboard/', moduleRoutes.root);
export function root(req: express.Request, res: express.Response) {
if (authorization.isAuthorized(req, res)) {
res.sendfile('./public/views/index.html');
} else {
res.sendfile('./public/views/login.html');
}
};













