]> Untitled Git - lemmy-ui.git/commitdiff
Fixing views for remote users. Fixes #120
authorDessalines <tyhou13@gmx.com>
Sat, 23 Jan 2021 23:23:09 +0000 (18:23 -0500)
committerDessalines <tyhou13@gmx.com>
Sat, 23 Jan 2021 23:23:09 +0000 (18:23 -0500)
src/shared/components/user.tsx
src/shared/routes.ts

index 555951e3da1e2757f76d953d0ac695983e11b22a..92b50b6b914eae4f22bbdea9aa799d4264b3f748 100644 (file)
@@ -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);
index 92a412ed4742f3c5325bebfec7fe16f1b39220af..c059ad9d29d091de4106cfb06aa528b39c7a4815 100644 (file)
@@ -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,