From 84f6bde9f3307473845df7a35a796f19b4376d15 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Fri, 9 Feb 2018 10:20:11 +0200 Subject: [PATCH 1/4] Add not-found error code --- src/util/types.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/types.js b/src/util/types.js index 81855bdb..c512b15d 100644 --- a/src/util/types.js +++ b/src/util/types.js @@ -392,6 +392,8 @@ export const ERROR_CODE_EMAIL_NOT_VERIFIED = 'email-unverified'; export const ERROR_CODE_TOO_MANY_VERIFICATION_REQUESTS = 'email-too-many-verification-requests'; export const ERROR_CODE_UPLOAD_OVER_LIMIT = 'request-upload-over-limit'; export const ERROR_CODE_VALIDATION_INVALID_PARAMS = 'validation-invalid-params'; +export const ERROR_CODE_NOT_FOUND = 'not-found'; + const ERROR_CODES = [ ERROR_CODE_TRANSACTION_LISTING_NOT_FOUND, ERROR_CODE_TRANSACTION_INVALID_TRANSITION, @@ -404,6 +406,7 @@ const ERROR_CODES = [ ERROR_CODE_TOO_MANY_VERIFICATION_REQUESTS, ERROR_CODE_UPLOAD_OVER_LIMIT, ERROR_CODE_VALIDATION_INVALID_PARAMS, + ERROR_CODE_NOT_FOUND, ]; // API error From f9e2f45a01b7eda9a6aba5ce539bb1a9af388657 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Fri, 9 Feb 2018 10:20:21 +0200 Subject: [PATCH 2/4] Fix listing page 404 Render NotFoundPage instead of redirect. This fixes the case when an old error resulted in a redirect for new listing page request. It is also better to keep the URL so it can be fixed to the correct one. --- src/containers/ListingPage/ListingPage.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/containers/ListingPage/ListingPage.js b/src/containers/ListingPage/ListingPage.js index 9c226d64..fa4c6ac9 100644 --- a/src/containers/ListingPage/ListingPage.js +++ b/src/containers/ListingPage/ListingPage.js @@ -24,7 +24,6 @@ import { Page, ResponsiveImage, NamedLink, - NamedRedirect, Modal, ImageCarousel, InlineTextButton, @@ -37,7 +36,7 @@ import { Reviews, PropertyGroup, } from '../../components'; -import { BookingDatesForm, TopbarContainer, EnquiryForm } from '../../containers'; +import { BookingDatesForm, TopbarContainer, EnquiryForm, NotFoundPage } from '../../containers'; import { sendEnquiry, loadData, setInitialValues } from './ListingPage.duck'; import EditIcon from './EditIcon'; @@ -292,7 +291,7 @@ export class ListingPageComponent extends Component { if (showListingError && showListingError.status === 404) { // 404 listing not found - return ; + return ; } else if (showListingError) { // Other error in fetching listing From 161a471234d50869d4147153c8b543c250b732d4 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Fri, 9 Feb 2018 10:29:33 +0200 Subject: [PATCH 3/4] Render NotFoundPage when user is not found --- src/containers/ProfilePage/ProfilePage.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/containers/ProfilePage/ProfilePage.js b/src/containers/ProfilePage/ProfilePage.js index 134cde77..492db36c 100644 --- a/src/containers/ProfilePage/ProfilePage.js +++ b/src/containers/ProfilePage/ProfilePage.js @@ -24,7 +24,7 @@ import { Reviews, ButtonTabNavHorizontal, } from '../../components'; -import { TopbarContainer } from '../../containers'; +import { TopbarContainer, NotFoundPage } from '../../containers'; import { loadData } from './ProfilePage.duck'; import config from '../../config'; @@ -210,7 +210,9 @@ export class ProfilePageComponent extends Component { let content; - if (userShowError || queryListingsError) { + if (userShowError && userShowError.status === 404) { + return ; + } else if (userShowError || queryListingsError) { content = (

From 343864e174bc26b463b70aeb64eba895084627fa Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Fri, 9 Feb 2018 10:32:07 +0200 Subject: [PATCH 4/4] Render NotFoundPage instead of redirect for invalid inbox tab --- src/containers/InboxPage/InboxPage.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/containers/InboxPage/InboxPage.js b/src/containers/InboxPage/InboxPage.js index 9d1eeff4..81ec37d2 100644 --- a/src/containers/InboxPage/InboxPage.js +++ b/src/containers/InboxPage/InboxPage.js @@ -25,7 +25,6 @@ import { isScrollingDisabled } from '../../ducks/UI.duck'; import { Avatar, NamedLink, - NamedRedirect, NotificationBadge, Page, PaginationLinks, @@ -37,7 +36,7 @@ import { LayoutWrapperFooter, Footer, } from '../../components'; -import { TopbarContainer } from '../../containers'; +import { TopbarContainer, NotFoundPage } from '../../containers'; import config from '../../config'; import { loadData } from './InboxPage.duck'; @@ -254,7 +253,7 @@ export const InboxPageComponent = props => { const validTab = tab === 'orders' || tab === 'sales'; if (!validTab) { - return ; + return ; } const isOrders = tab === 'orders';