From ec85159c65ed3a8b687713b54666dfb18b6cc93b Mon Sep 17 00:00:00 2001 From: SabreCat Date: Mon, 11 Sep 2023 22:53:14 -0500 Subject: [PATCH] feat(profiles): load modal instead of page? --- website/client/src/router/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/website/client/src/router/index.js b/website/client/src/router/index.js index ea8cceb6e9..dca120ebb6 100644 --- a/website/client/src/router/index.js +++ b/website/client/src/router/index.js @@ -319,11 +319,19 @@ router.beforeEach(async (to, from, next) => { }); } - if ((to.name === 'userProfile' || to.name === 'userProfilePage') && from.name !== null) { + if ((to.name === 'userProfile' || to.name === 'userProfilePage')) { let startingPage = 'profile'; if (to.params.startingPage !== undefined) { startingPage = to.params.startingPage; } + if (from.name === null) { + setTimeout(() => router.app.$emit('habitica:show-profile', { + userId: to.params.userId, + startingPage, + path: to.path, + }), 500); + return next({ name: 'tasks' }); + } router.app.$emit('habitica:show-profile', { userId: to.params.userId, startingPage,