मैं एक AngularJS परियोजना पर काम कर रहा हूँ और मैं बहुत वेब के लिए नया हूँ। क्या मैं प्राप्त करने के लिए कोशिश कर रहा हूँ सरल लॉगिन है। मैं सर्वर साइड (NodeJS) पर है और यह भी ग्राहक के पक्ष में टोकन आधार प्रमाणन को लागू किया है,।
सब कुछ अच्छा काम करने लगता है। सिवाय जब मैं करने की कोशिश
इस। $ window.location.href
जब मैं लॉगिन क्लिक करें, अगर मेरे प्रमाणीकरण ठीक से काम कर रहा है परीक्षण करने के लिए, मैं एक अधिकृत अंत बिंदु यह पूरी तरह से काम करने के लिए एक $ http.get कहा जाता है। तब मैं NodeJS (सेवा कर) के लिए एक कॉल मुझे एक दिया endpoint है, जो प्रमाणीकरण टोकन हेडर की जरूरत पर एक पृष्ठ की सेवा के लिए बनाते हैं। लेकिन इसकी भेजा जा रहा।
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 कोड
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');
}
};













