Fixed messed up stuff
This commit is contained in:
parent
bad1c5b8d7
commit
9198b48517
10
src/main.ts
10
src/main.ts
|
@ -95,15 +95,15 @@ async function prepareLoginModal(register: boolean) {
|
|||
</div>
|
||||
`))
|
||||
})
|
||||
.catch((err) => {
|
||||
prepareLoginModal(false)
|
||||
$('#verification-alert').html(`
|
||||
.catch((err) => {
|
||||
prepareLoginModal(false)
|
||||
$('#verification-alert').html(`
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>Error!</strong> ${err}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
`)
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
document.querySelector<HTMLHeadingElement>('#loginModalLabel')!.innerText = 'Login to your Apexie ID'
|
||||
|
@ -112,10 +112,10 @@ async function prepareLoginModal(register: boolean) {
|
|||
<button type="button" id="account-register" class="btn btn-primary">Register</button>
|
||||
<button type="submit" id="account-login" class="btn btn-primary">Login</button>
|
||||
`
|
||||
document.getElementById('account-register')!.addEventListener('click', () => prepareLoginModal(true))
|
||||
}
|
||||
document.querySelector<HTMLDivElement>('#account-username-fill')!.hidden = !register
|
||||
document.querySelector<HTMLDivElement>('#account-confirm-password-fill')!.hidden = !register
|
||||
document.getElementById('account-register')!.addEventListener('click', () => prepareLoginModal(true))
|
||||
document.getElementById('account-login')!.addEventListener('click', async () => {
|
||||
await pb.collection('users').authWithPassword((<HTMLInputElement>document.getElementById('account-email')!).value, (<HTMLInputElement>document.getElementById('account-password')!).value).catch((err) => {
|
||||
$('#verification-alert').html(`
|
||||
|
|
|
@ -26,7 +26,7 @@ pb.collection('users').authWithOAuth2(
|
|||
}
|
||||
).then(() => {
|
||||
// document.getElementById('content').innerText = JSON.stringify(authData, null, 2);
|
||||
new Location().assign('/')
|
||||
window.location.href = '/'
|
||||
}).catch((err) => {
|
||||
document.getElementById('content')!.innerText = "Failed to exchange code.\n" + err
|
||||
})
|
Loading…
Reference in New Issue