Fixing broken federated community paging. Fixes #166

This commit is contained in:
Dessalines 2021-02-08 15:14:34 -05:00
parent f2fe356384
commit 4b43cdf143
2 changed files with 12 additions and 2 deletions

View file

@ -405,8 +405,13 @@ export class Community extends Component<any, State> {
const dataTypeStr = paramUpdates.dataType || DataType[this.state.dataType]; const dataTypeStr = paramUpdates.dataType || DataType[this.state.dataType];
const sortStr = paramUpdates.sort || this.state.sort; const sortStr = paramUpdates.sort || this.state.sort;
const page = paramUpdates.page || this.state.page; const page = paramUpdates.page || this.state.page;
let typeView = this.state.communityName
? `/c/${this.state.communityName}`
: `/community/${this.state.communityId}`;
this.props.history.push( this.props.history.push(
`/c/${this.state.communityRes.community_view.community.name}/data_type/${dataTypeStr}/sort/${sortStr}/page/${page}` `${typeView}/data_type/${dataTypeStr}/sort/${sortStr}/page/${page}`
); );
} }

View file

@ -73,7 +73,7 @@ export const routes: IRoutePropsWithFetch[] = [
fetchInitialData: req => Post.fetchInitialData(req), fetchInitialData: req => Post.fetchInitialData(req),
}, },
{ {
path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`, path: `/community/:id/data_type/:data_type/sort/:sort/page/:page`,
component: Community, component: Community,
fetchInitialData: req => Community.fetchInitialData(req), fetchInitialData: req => Community.fetchInitialData(req),
}, },
@ -82,6 +82,11 @@ export const routes: IRoutePropsWithFetch[] = [
component: Community, component: Community,
fetchInitialData: req => Community.fetchInitialData(req), fetchInitialData: req => Community.fetchInitialData(req),
}, },
{
path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
component: Community,
fetchInitialData: req => Community.fetchInitialData(req),
},
{ {
path: `/c/:name`, path: `/c/:name`,
component: Community, component: Community,