forked from potsda.mn/mobilizon
Redirect from Login page to Homepage if already logged-in
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
16f90254a0
commit
bfc9dd7ea3
|
@ -118,7 +118,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
||||
import { Route } from "vue-router";
|
||||
import { ICurrentUser } from "@/types/current-user.model";
|
||||
import { LoginError, LoginErrorCode } from "@/types/enums";
|
||||
|
@ -269,6 +269,13 @@ export default class Login extends Vue {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Watch("currentUser")
|
||||
redirectToHomepageIfAlreadyLoggedIn(): Promise<Route> | void {
|
||||
if (this.currentUser.isLoggedIn) {
|
||||
return this.$router.push("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue