From 48060055e43a7cc60e8185e4bb9647cb96daf741 Mon Sep 17 00:00:00 2001 From: Chinweike Michael Chinonso Date: Fri, 11 Mar 2022 08:14:25 +0100 Subject: [PATCH 1/2] feat:moved display url to different route path #81 --- src/constant/index.ts | 1 + src/router/index.ts | 9 +++++++-- src/views/ProfileDetails.vue | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/constant/index.ts b/src/constant/index.ts index b14ba6a..32a4cf6 100644 --- a/src/constant/index.ts +++ b/src/constant/index.ts @@ -1,4 +1,5 @@ export const USER_PROFILE = "PROFILE"; +export const USER_PROFILE_REDIRECT = "PROFILE_REDIRECT"; export const BASIC_PROFILE_SCHEMA = "https://common.schemas.verida.io/social/contact/v0.1.0/schema.json"; diff --git a/src/router/index.ts b/src/router/index.ts index 3401a34..9228805 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,6 +1,6 @@ import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router"; -import Home from "../views/Home.vue"; import { USER_PROFILE } from "../constant/index"; +import Home from "../views/Home.vue"; const routes: Array = [ { @@ -9,7 +9,12 @@ const routes: Array = [ component: Home, }, { - path: "/:did", + path: "/did", + name: "Redirect", + redirect: "/" + }, + { + path: "/did/:did", name: USER_PROFILE, component: () => import(/* webpackChunkName: "about" */ "../views/ProfileDetails.vue"), diff --git a/src/views/ProfileDetails.vue b/src/views/ProfileDetails.vue index 3a12ba4..6062bcc 100644 --- a/src/views/ProfileDetails.vue +++ b/src/views/ProfileDetails.vue @@ -29,8 +29,15 @@ export default defineComponent({ await this.fetchProfile(did); }, }, - async beforeMount() { + console.log("log."); + + if (!this.$route.params.did) { + console.log("dsdd"); + + this.$router.push({ path: "/" }); + } + if (!this.profile.name) { await this.loadProfile(); } From cce99f4e2e7d7f7bb0f9b8e078cda5bce231c637 Mon Sep 17 00:00:00 2001 From: Chinweike Michael Chinonso Date: Tue, 15 Mar 2022 10:05:20 +0100 Subject: [PATCH 2/2] fix: home page did url - linting issues #81 --- src/router/index.ts | 2 +- src/views/Home.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 9228805..514aa3f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -11,7 +11,7 @@ const routes: Array = [ { path: "/did", name: "Redirect", - redirect: "/" + redirect: "/", }, { path: "/did/:did", diff --git a/src/views/Home.vue b/src/views/Home.vue index 5705c3b..e8de732 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -12,7 +12,7 @@ v-else-if="profile.name" :profile="profile" :path="path" - :url="[`/${profile.did}`]" + :url="[`/did/${profile.did}`]" />