Also fix in register
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
Jan Bader 2022-02-21 21:41:24 +00:00
parent e9d4ed1b3e
commit ffabf1bca9

View File

@ -5,6 +5,7 @@ import { useSessionStore } from "../stores/session";
const error = ref(""); const error = ref("");
const login = ref({ email: "", password: "", name: "" }); const login = ref({ email: "", password: "", name: "" });
const router = useRouter(); // has to be called in setup
onMounted(() => { onMounted(() => {
useSessionStore().setTitle("Login"); useSessionStore().setTitle("Login");
@ -15,7 +16,8 @@ function formSubmit(e: MouseEvent) {
useSessionStore().register(login.value) useSessionStore().register(login.value)
.then(x => { .then(x => {
error.value = ""; error.value = "";
useRouter().replace("/dashboard"); router.replace("/dashboard");
return x;
}) })
.catch(x => error.value = "The entered credentials are invalid!"); .catch(x => error.value = "The entered credentials are invalid!");