From 8c3c27002bf0c2b0b21727492b8ee3c8aa9b37c1 Mon Sep 17 00:00:00 2001 From: Dessalines <tyhou13@gmx.com> Date: Sat, 23 Jan 2021 18:23:09 -0500 Subject: [PATCH] Fixing views for remote users. Fixes #120 --- src/shared/components/user.tsx | 7 ++++++- src/shared/routes.ts | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/shared/components/user.tsx b/src/shared/components/user.tsx index 555951e..92b50b6 100644 --- a/src/shared/components/user.tsx +++ b/src/shared/components/user.tsx @@ -885,8 +885,13 @@ export class User extends Component<any, UserState> { const page = paramUpdates.page || this.state.page; const viewStr = paramUpdates.view || UserDetailsView[this.state.view]; const sortStr = paramUpdates.sort || this.state.sort; + + let typeView = this.state.userName + ? `/u/${this.state.userName}` + : `/user/${this.state.userId}`; + this.props.history.push( - `/u/${this.state.userName}/view/${viewStr}/sort/${sortStr}/page/${page}` + `${typeView}/view/${viewStr}/sort/${sortStr}/page/${page}` ); this.state.loading = true; this.setState(this.state); diff --git a/src/shared/routes.ts b/src/shared/routes.ts index 92a412e..c059ad9 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -92,6 +92,11 @@ export const routes: IRoutePropsWithFetch[] = [ component: User, fetchInitialData: req => User.fetchInitialData(req), }, + { + path: `/user/:id/view/:view/sort/:sort/page/:page`, + component: User, + fetchInitialData: req => User.fetchInitialData(req), + }, { path: `/user/:id`, component: User, -- 2.44.1