|
|
|
@ -4,7 +4,7 @@ import Spinner from '../Spinner.astro'; |
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
<button |
|
|
|
|
class='inline-flex h-10 w-full items-center justify-center rounded border border-slate-300 bg-white p-2 text-sm font-medium text-black outline-none transition duration-150 ease-in-out focus:ring-2 focus:ring-[#333] focus:ring-offset-1 disabled:opacity-60' |
|
|
|
|
class='inline-flex h-10 w-full items-center justify-center rounded border border-slate-300 bg-white p-2 text-sm font-medium text-black outline-none transition duration-150 ease-in-out focus:ring-2 focus:ring-[#333] focus:ring-offset-1 disabled:opacity-60 disabled:cursor-not-allowed' |
|
|
|
|
id='github-login-button' |
|
|
|
|
> |
|
|
|
|
<Spinner class='hidden text-black' id='github-login-spinner' /> |
|
|
|
@ -60,11 +60,10 @@ import Spinner from '../Spinner.astro'; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.then((data) => { |
|
|
|
|
// Remove spinner |
|
|
|
|
hideSpinner(); |
|
|
|
|
// Redirect to google login |
|
|
|
|
if (data.loginUrl) { |
|
|
|
|
window.location.href = data.loginUrl; |
|
|
|
|
githubLoginButton?.removeAttribute('disabled'); |
|
|
|
|
} else { |
|
|
|
|
// Else throw error |
|
|
|
|
throw new Error('Something went wrong.'); |
|
|
|
@ -110,7 +109,7 @@ import Spinner from '../Spinner.astro'; |
|
|
|
|
Cookies.set(TOKEN_COOKIE_NAME, data.token); |
|
|
|
|
|
|
|
|
|
// Redirect to the page the user was on before login |
|
|
|
|
history.go(-2); |
|
|
|
|
window.location.href = '/'; |
|
|
|
|
} else { |
|
|
|
|
throw new Error('Something went wrong.'); |
|
|
|
|
} |
|
|
|
|