Revert back to inbox tab as path param

Inbox links were broken, and could not simply be fixed by editing the
links. The loadData function needs to know the tab as well, and
currently it doesn't have the information if the tab isn't in the path
params.
This commit is contained in:
Kimmo Puputti 2017-05-11 10:22:58 +03:00
parent 389e376abf
commit afdf009af3
4 changed files with 7 additions and 15 deletions

View file

@ -32,7 +32,7 @@ const MobileMenu = props => {
}
const inboxLink = (
<NamedLink name={currentUserHasListings ? 'InboxSalesPage' : 'InboxOrdersPage'}>
<NamedLink name="InboxPage" params={{ tab: currentUserHasListings ? 'sales' : 'orders' }}>
<FormattedMessage id="MobileMenu.inboxLink" />
</NamedLink>
);

View file

@ -28,7 +28,7 @@ export const OrderPageComponent = props => {
if (isDataAvailable && !isOwnSale) {
// eslint-disable-next-line no-console
console.error('Tried to access an order that was not owned by the current user');
return <NamedRedirect name="InboxOrdersPage" />;
return <NamedRedirect name="InboxPage" params={{ tab: 'orders' }} />;
}
const detailsProps = {

View file

@ -37,7 +37,7 @@ export const SalePageComponent = props => {
if (isDataAvailable && !isOwnSale) {
// eslint-disable-next-line no-console
console.error('Tried to access a sale that was not owned by the current user');
return <NamedRedirect name="InboxSalesPage" />;
return <NamedRedirect name="InboxPage" params={{ tab: 'sales' }} />;
}
const detailsProps = {

View file

@ -158,22 +158,14 @@ const routesConfiguration = [
auth: true,
exact: true,
name: 'InboxBasePage',
component: () => <NamedRedirect name="InboxSalesPage" />,
component: () => <NamedRedirect name="InboxPage" params={{ tab: 'sales' }} />,
},
{
path: '/inbox/sales',
path: '/inbox/:tab',
auth: true,
exact: true,
name: 'InboxSalesPage',
component: props => <InboxPage {...props} tab="sales" />,
loadData: (params, search) => InboxPage.loadData(params, search),
},
{
path: '/inbox/orders',
auth: true,
exact: true,
name: 'InboxOrdersPage',
component: props => <InboxPage {...props} tab="orders" />,
name: 'InboxPage',
component: props => <InboxPage {...props} />,
loadData: (params, search) => InboxPage.loadData(params, search),
},
{