-
Notifications
You must be signed in to change notification settings - Fork 14
passwordless example for angular #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 0.1
Are you sure you want to change the base?
Conversation
Object.assign(this.user, userAndPayloadInfo); | ||
}).catch((err) => { | ||
console.log(err); | ||
this.router.navigate["/login"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a syntax error in the navigation method call. The correct syntax is this.router.navigate(['/login'])
with parentheses for the method call rather than square brackets. The current code this.router.navigate["/login"]
is attempting to access a property of the navigate object rather than calling the navigate method.
this.router.navigate["/login"]; | |
this.router.navigate(["/login"]); |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
app.use(function(req, res, next){ | ||
console.log(req.url); | ||
console.log(req.headers); | ||
console.log(req.body || (req.method + " method")); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The middleware function is missing a call to next()
, which will cause all requests to hang indefinitely. To fix this issue, add next()
at the end of the function:
app.use(function(req, res, next){
console.log(req.url);
console.log(req.headers);
console.log(req.body || (req.method + " method"));
next(); // Add this line to continue the request processing
});
Without this call, Express won't proceed to subsequent middleware or route handlers.
app.use(function(req, res, next){ | |
console.log(req.url); | |
console.log(req.headers); | |
console.log(req.body || (req.method + " method")); | |
}) | |
app.use(function(req, res, next){ | |
console.log(req.url); | |
console.log(req.headers); | |
console.log(req.body || (req.method + " method")); | |
next(); | |
}); |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
if(this.router.getCurrentNavigation().extras.state && this.router.getCurrentNavigation().extras.state.errorText){ | ||
this.errorText = this.router.getCurrentNavigation().extras.state.errorText; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code as written may cause a null reference error if getCurrentNavigation()
returns null, which can happen when the component is not initialized during a navigation event. To prevent this, consider using optional chaining:
const navigation = this.router.getCurrentNavigation();
if (navigation?.extras?.state?.errorText) {
this.errorText = navigation.extras.state.errorText;
}
This approach safely handles cases where any part of the navigation chain is undefined or null.
if(this.router.getCurrentNavigation().extras.state && this.router.getCurrentNavigation().extras.state.errorText){ | |
this.errorText = this.router.getCurrentNavigation().extras.state.errorText; | |
} | |
const navigation = this.router.getCurrentNavigation(); | |
if(navigation?.extras?.state?.errorText){ | |
this.errorText = navigation.extras.state.errorText; | |
} |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
export const environment = { | ||
production: true | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The production environment configuration is missing the same properties that are defined in the development environment: apiDomain
, apiBasePath
, and appName
. These properties are required by the AuthService for proper initialization. Consider adding these with appropriate production values:
export const environment = {
production: true,
apiDomain: "https://your-production-api-domain.com",
apiBasePath: "/api",
appName: "SuperTokens Passwordless Demo - Angular"
};
export const environment = { | |
production: true | |
}; | |
export const environment = { | |
production: true, | |
apiDomain: "https://your-production-api-domain.com", | |
apiBasePath: "/api", | |
appName: "SuperTokens Passwordless Demo - Angular" | |
}; | |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
Summary of change
Passwordless implementation in angular using supertokens-web-js