Also fix in register
This commit is contained in:
parent
e9d4ed1b3e
commit
ffabf1bca9
@ -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!");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user