Refactor router

This commit is contained in:
Chocobozzz
2019-02-22 14:55:47 +01:00
committed by Thomas Citharel
parent d73f738b1b
commit 53cb39350a
19 changed files with 316 additions and 288 deletions

View File

@@ -69,6 +69,7 @@
import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor";
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import EventCard from "@/components/Event/EventCard.vue";
import { RouteName } from '@/router'
@Component({
apollo: {
@@ -101,7 +102,7 @@ export default class Profile extends Vue {
logoutUser() {
// TODO : implement logout
this.$router.push({ name: "Home" });
this.$router.push({ name: RouteName.HOME });
}
nl2br(text) {

View File

@@ -80,17 +80,13 @@
</template>
<script lang="ts">
import Gravatar from "vue-gravatar";
import { Component, Prop, Vue } from "vue-property-decorator";
import { IPerson } from "@/types/actor.model";
import { REGISTER_PERSON } from "@/graphql/actor";
import { MOBILIZON_INSTANCE_HOST } from "@/api/_entrypoint";
import { RouteName } from '@/router'
@Component({
components: {
"v-gravatar": Gravatar
}
})
@Component
export default class Register extends Vue {
@Prop({ type: String, required: true }) email!: string;
@Prop({ type: Boolean, required: false, default: false }) userAlreadyActivated!: boolean;
@@ -98,20 +94,19 @@ export default class Register extends Vue {
host: string = MOBILIZON_INSTANCE_HOST;
person: IPerson = {
preferredUsername: "",
name: "",
summary: "",
id: "",
url: "",
preferredUsername: '',
name: '',
summary: '',
id: '',
url: '',
suspended: false,
avatarUrl: "", // TODO : Use Gravatar here
bannerUrl: "",
avatarUrl: '',
bannerUrl: '',
domain: null,
};
errors: object = {};
validationSent: boolean = false;
sendingValidation: boolean = false;
showGravatar: boolean = false;
async submit() {
try {
@@ -124,7 +119,7 @@ export default class Register extends Vue {
this.validationSent = true;
if (this.userAlreadyActivated) {
this.$router.push({name: "Home"});
this.$router.push({ name: RouteName.HOME });
}
} catch (error) {
this.errors = error.graphQLErrors.reduce((acc, error) => {