mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-22 16:03:25 +00:00
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
1 changed files with 8 additions and 1 deletions
|
@ -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