ensure player is loaded
This commit is contained in:
parent
573873fd0e
commit
2049c008fd
|
|
@ -17,6 +17,7 @@ import { useStore } from 'vuex'
|
|||
import * as yup from 'yup';
|
||||
import PitchTypeService from "@/services/PitchTypeService";
|
||||
import PitchType from "@/types/PitchType";
|
||||
import User from "@/types/User";
|
||||
|
||||
const loading = ref(false);
|
||||
// const server = JSON.parse(localStorage.getItem("server") || '""');
|
||||
|
|
@ -49,16 +50,18 @@ onMounted(() => {
|
|||
}
|
||||
});
|
||||
|
||||
const submit = handleSubmit((values, { resetForm }) => {
|
||||
const submit = handleSubmit((values, { /*resetForm*/ }) => {
|
||||
store.dispatch('auth/login', {
|
||||
email: values.email,
|
||||
password: values.password,
|
||||
}).then(() => {
|
||||
resetForm();
|
||||
onLogin();
|
||||
}).then((user: User) => {
|
||||
return store.dispatch('player/determinePlayer', user);
|
||||
}, error => {
|
||||
loading.value = false;
|
||||
console.log(error);
|
||||
}).then(() => {
|
||||
// resetForm();
|
||||
onLogin();
|
||||
});
|
||||
}, ({errors}) => {
|
||||
console.log(errors);
|
||||
|
|
@ -130,7 +133,7 @@ const changeServer = () => {
|
|||
</ion-input>
|
||||
</Field>
|
||||
</ion-item>
|
||||
<ion-button expand="block" class="ion-margin-top" type="submit" @click="submit">Login</ion-button>
|
||||
<ion-button expand="block" class="ion-margin-top" type="submit">Login</ion-button>
|
||||
</form>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
|
|
|||
Loading…
Reference in New Issue