Skip to content

Commit

Permalink
Merge pull request #89 from verida/feature/81-move-account-display-url
Browse files Browse the repository at this point in the history
feat:moved display url to different route path
  • Loading branch information
nick-verida authored Mar 17, 2022
2 parents 1b409a8 + cce99f4 commit 54dc368
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
@@ -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";
9 changes: 7 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -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<RouteRecordRaw> = [
{
Expand All @@ -9,7 +9,12 @@ const routes: Array<RouteRecordRaw> = [
component: Home,
},
{
path: "/:did",
path: "/did",
name: "Redirect",
redirect: "/",
},
{
path: "/did/:did",
name: USER_PROFILE,
component: () =>
import(/* webpackChunkName: "about" */ "../views/ProfileDetails.vue"),
Expand Down
2 changes: 1 addition & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
v-else-if="profile.name"
:profile="profile"
:path="path"
:url="[`/${profile.did}`]"
:url="[`/did/${profile.did}`]"
/>
</div>
<div class="landing-image">
Expand Down
9 changes: 8 additions & 1 deletion src/views/ProfileDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 54dc368

Please sign in to comment.