Skip to content
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

After logout, login button has no click handler #1

Open
plitzenberger opened this issue May 12, 2021 · 0 comments
Open

After logout, login button has no click handler #1

plitzenberger opened this issue May 12, 2021 · 0 comments

Comments

@plitzenberger
Copy link

Looks like init() needs to be called after rending content:

const init = async () => {
const authClient = await AuthClient.create();
if (await authClient.isAuthenticated()) {
handleAuthenticated(authClient);
}
renderIndex();
const loginButton = document.getElementById(
"loginButton"
) as HTMLButtonElement;
loginButton.onclick = async () => {
await authClient.login({
onSuccess: async () => {
handleAuthenticated(authClient);
},
});
};
};

(document.getElementById("logout") as HTMLButtonElement).onclick =
async () => {
await authClient.logout();
renderIndex();
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant