diff --git a/src/components/Page/Page.js b/src/components/Page/Page.js
index f53f0aa4..e9367626 100644
--- a/src/components/Page/Page.js
+++ b/src/components/Page/Page.js
@@ -54,7 +54,6 @@ class PageComponent extends Component {
const {
className,
rootClassName,
- authInfoError,
children,
history,
intl,
@@ -77,9 +76,6 @@ class PageComponent extends Component {
// TODO: use FlashMessages for auth errors
/* eslint-disable no-console */
- if (authInfoError && console && console.error) {
- console.error(authInfoError);
- }
if (logoutError && console && console.error) {
console.error(logoutError);
}
@@ -184,11 +180,6 @@ class PageComponent extends Component {
{metaTags}
- {authInfoError ? (
-
-
-
- ) : null}
{logoutError ? (
@@ -206,7 +197,6 @@ PageComponent.defaultProps = {
className: null,
rootClassName: null,
children: null,
- authInfoError: null,
logoutError: null,
scrollingDisabled: false,
author: null,
@@ -226,7 +216,6 @@ PageComponent.propTypes = {
className: string,
rootClassName: string,
children: any,
- authInfoError: propTypes.error,
logoutError: propTypes.error,
scrollingDisabled: bool,
diff --git a/src/containers/AuthenticationPage/AuthenticationPage.js b/src/containers/AuthenticationPage/AuthenticationPage.js
index cd97b4ee..4d186af3 100644
--- a/src/containers/AuthenticationPage/AuthenticationPage.js
+++ b/src/containers/AuthenticationPage/AuthenticationPage.js
@@ -35,7 +35,6 @@ import css from './AuthenticationPage.css';
export const AuthenticationPageComponent = props => {
const {
- authInfoError,
authInProgress,
currentUser,
intl,
@@ -211,7 +210,6 @@ export const AuthenticationPageComponent = props => {
return (
{
};
AuthenticationPageComponent.defaultProps = {
- authInfoError: null,
currentUser: null,
loginError: null,
logoutError: null,
@@ -251,7 +248,6 @@ AuthenticationPageComponent.defaultProps = {
const { bool, func, object, oneOf, shape } = PropTypes;
AuthenticationPageComponent.propTypes = {
- authInfoError: propTypes.error,
authInProgress: bool.isRequired,
currentUser: propTypes.currentUser,
isAuthenticated: bool.isRequired,
@@ -275,10 +271,9 @@ AuthenticationPageComponent.propTypes = {
};
const mapStateToProps = state => {
- const { authInfoError, isAuthenticated, loginError, logoutError, signupError } = state.Auth;
+ const { isAuthenticated, loginError, logoutError, signupError } = state.Auth;
const { currentUser, sendVerificationEmailInProgress, sendVerificationEmailError } = state.user;
return {
- authInfoError,
authInProgress: authenticationInProgress(state),
currentUser,
isAuthenticated,
diff --git a/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap b/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap
index 09f1a40f..9980bf65 100644
--- a/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap
+++ b/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`AuthenticationPageComponent matches snapshot 1`] = `
);
- const pageProps = { authInfoError, logoutError, title };
+ const pageProps = { logoutError, title };
if (isLoading) {
return (
@@ -372,7 +371,6 @@ export class CheckoutPageComponent extends Component {
}
CheckoutPageComponent.defaultProps = {
- authInfoError: null,
initiateOrderError: null,
listing: null,
bookingDates: null,
@@ -385,7 +383,6 @@ CheckoutPageComponent.defaultProps = {
const { func, instanceOf, shape, string, bool } = PropTypes;
CheckoutPageComponent.propTypes = {
- authInfoError: propTypes.error,
listing: propTypes.listing,
bookingDates: shape({
bookingStart: instanceOf(Date).isRequired,
@@ -423,10 +420,9 @@ const mapStateToProps = state => {
initiateOrderError,
} = state.CheckoutPage;
const { currentUser } = state.user;
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
return {
currentUser,
- authInfoError,
logoutError,
bookingDates,
speculateTransactionInProgress,
diff --git a/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap b/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap
index c5d3b25e..87ce24f3 100644
--- a/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap
+++ b/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`CheckoutPage matches snapshot 1`] = `
diff --git a/src/containers/ContactDetailsPage/ContactDetailsPage.js b/src/containers/ContactDetailsPage/ContactDetailsPage.js
index 23c263e3..4948acf6 100644
--- a/src/containers/ContactDetailsPage/ContactDetailsPage.js
+++ b/src/containers/ContactDetailsPage/ContactDetailsPage.js
@@ -25,7 +25,6 @@ import css from './ContactDetailsPage.css';
export const ContactDetailsPageComponent = props => {
const {
- authInfoError,
changeEmailError,
changeEmailInProgress,
currentUser,
@@ -75,12 +74,7 @@ export const ContactDetailsPageComponent = props => {
) : null;
return (
-
+
{
};
ContactDetailsPageComponent.defaultProps = {
- authInfoError: null,
changeEmailError: null,
currentUser: null,
logoutError: null,
@@ -120,7 +113,6 @@ ContactDetailsPageComponent.defaultProps = {
const { bool, func } = PropTypes;
ContactDetailsPageComponent.propTypes = {
- authInfoError: propTypes.error,
changeEmailError: propTypes.error,
changeEmailInProgress: bool.isRequired,
currentUser: propTypes.currentUser,
@@ -135,13 +127,12 @@ ContactDetailsPageComponent.propTypes = {
};
const mapStateToProps = state => {
- // Page needs authInfoError and logoutError, Topbar needs isAuthenticated
- const { authInfoError, isAuthenticated, logoutError } = state.Auth;
+ // Page needs logoutError, Topbar needs isAuthenticated
+ const { isAuthenticated, logoutError } = state.Auth;
// Topbar needs user info.
const { currentUser, sendVerificationEmailInProgress, sendVerificationEmailError } = state.user;
const { changeEmailError, changeEmailInProgress, emailChanged } = state.ContactDetailsPage;
return {
- authInfoError,
changeEmailError,
changeEmailInProgress,
currentUser,
diff --git a/src/containers/ContactDetailsPage/__snapshots__/ContactDetailsPage.test.js.snap b/src/containers/ContactDetailsPage/__snapshots__/ContactDetailsPage.test.js.snap
index bc4f8baa..e6801544 100644
--- a/src/containers/ContactDetailsPage/__snapshots__/ContactDetailsPage.test.js.snap
+++ b/src/containers/ContactDetailsPage/__snapshots__/ContactDetailsPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`ContactDetailsPage matches snapshot 1`] = `
{
// N.B. All the presentational content needs to be extracted to their own components
export const EditListingPageComponent = props => {
const {
- authInfoError,
currentUser,
createStripeAccountError,
fetchInProgress,
@@ -116,12 +115,7 @@ export const EditListingPageComponent = props => {
: intl.formatMessage({ id: 'EditListingPage.titleEditListing' });
return (
-
+
{
};
EditListingPageComponent.defaultProps = {
- authInfoError: null,
createStripeAccountError: null,
currentUser: null,
currentUserHasOrders: null,
@@ -180,7 +173,6 @@ EditListingPageComponent.defaultProps = {
const { bool, func, object, shape, string, oneOf } = PropTypes;
EditListingPageComponent.propTypes = {
- authInfoError: propTypes.error,
createStripeAccountError: propTypes.error,
currentUser: propTypes.currentUser,
fetchInProgress: bool.isRequired,
@@ -217,7 +209,7 @@ EditListingPageComponent.propTypes = {
const mapStateToProps = state => {
const page = state.EditListingPage;
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const { createStripeAccountInProgress, createStripeAccountError, currentUser } = state.user;
const fetchInProgress = createStripeAccountInProgress;
@@ -227,7 +219,6 @@ const mapStateToProps = state => {
return listings.length === 1 ? listings[0] : null;
};
return {
- authInfoError,
createStripeAccountError,
currentUser,
fetchInProgress,
diff --git a/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap b/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap
index 572f50bc..3ea2dffc 100644
--- a/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap
+++ b/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`EditListingPageComponent matches snapshot 1`] = `
{
export const EmailVerificationPageComponent = props => {
const {
- authInfoError,
currentUser,
intl,
logoutError,
@@ -61,12 +60,7 @@ export const EmailVerificationPageComponent = props => {
const initialValues = { verificationToken: parseVerificationToken(location) };
return (
-
+
@@ -97,7 +91,6 @@ export const EmailVerificationPageComponent = props => {
};
EmailVerificationPageComponent.defaultProps = {
- authInfoError: null,
currentUser: null,
logoutError: null,
verificationError: null,
@@ -106,7 +99,6 @@ EmailVerificationPageComponent.defaultProps = {
const { bool, func, shape, string } = PropTypes;
EmailVerificationPageComponent.propTypes = {
- authInfoError: propTypes.error,
currentUser: propTypes.currentUser,
logoutError: propTypes.error,
scrollingDisabled: bool.isRequired,
@@ -124,11 +116,10 @@ EmailVerificationPageComponent.propTypes = {
};
const mapStateToProps = state => {
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const { currentUser } = state.user;
const { verificationError } = state.EmailVerification;
return {
- authInfoError,
verificationError,
currentUser,
logoutError,
diff --git a/src/containers/InboxPage/InboxPage.js b/src/containers/InboxPage/InboxPage.js
index 203228e1..d9b68e31 100644
--- a/src/containers/InboxPage/InboxPage.js
+++ b/src/containers/InboxPage/InboxPage.js
@@ -166,7 +166,6 @@ InboxItem.propTypes = {
export const InboxPageComponent = props => {
const {
- authInfoError,
currentUser,
fetchInProgress,
fetchOrdersOrSalesError,
@@ -261,12 +260,7 @@ export const InboxPageComponent = props => {
const nav = ;
return (
-
+
{
};
InboxPageComponent.defaultProps = {
- authInfoError: null,
currentUser: null,
currentUserHasOrders: null,
fetchOrdersOrSalesError: null,
@@ -314,7 +307,6 @@ InboxPageComponent.propTypes = {
tab: string.isRequired,
}).isRequired,
- authInfoError: propTypes.error,
currentUser: propTypes.currentUser,
fetchInProgress: bool.isRequired,
fetchOrdersOrSalesError: propTypes.error,
@@ -330,10 +322,9 @@ InboxPageComponent.propTypes = {
const mapStateToProps = state => {
const { fetchInProgress, fetchOrdersOrSalesError, pagination, transactionRefs } = state.InboxPage;
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const { currentUser, currentUserNotificationCount: providerNotificationCount } = state.user;
return {
- authInfoError,
currentUser,
fetchInProgress,
fetchOrdersOrSalesError,
diff --git a/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap b/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap
index 6e42fe44..0f335eaa 100644
--- a/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap
+++ b/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`InboxPage matches snapshot 1`] = `
{
- const { authInfoError, history, intl, location, logoutError, scrollingDisabled } = props;
+ const { history, intl, location, logoutError, scrollingDisabled } = props;
// Schema for search engines (helps them to understand what this page is about)
// http://schema.org
@@ -36,7 +36,6 @@ export const LandingPageComponent = props => {
return (
{
};
LandingPageComponent.defaultProps = {
- authInfoError: null,
logoutError: null,
};
const { bool, object } = PropTypes;
LandingPageComponent.propTypes = {
- authInfoError: propTypes.error,
logoutError: propTypes.error,
scrollingDisabled: bool.isRequired,
@@ -90,9 +87,8 @@ LandingPageComponent.propTypes = {
};
const mapStateToProps = state => {
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
return {
- authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
};
diff --git a/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap b/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap
index 12c6ec06..85e11b0e 100644
--- a/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap
+++ b/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`LandingPage matches snapshot 1`] = `
{
const { showListingError } = state.ListingPage;
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const { currentUser } = state.user;
const getListing = id => {
@@ -538,7 +534,6 @@ const mapStateToProps = state => {
};
return {
- authInfoError,
currentUser,
getListing,
logoutError,
diff --git a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap
index 2bab23fa..9d0a7e74 100644
--- a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap
+++ b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`ListingPage matches snapshot 1`] = `
+
@@ -159,7 +153,6 @@ export class ManageListingsPageComponent extends Component {
}
ManageListingsPageComponent.defaultProps = {
- authInfoError: null,
listings: [],
logoutError: null,
pagination: null,
@@ -174,7 +167,6 @@ ManageListingsPageComponent.defaultProps = {
const { arrayOf, bool, func, object, shape, string } = PropTypes;
ManageListingsPageComponent.propTypes = {
- authInfoError: propTypes.error,
closingListing: shape({ uuid: string.isRequired }),
closingListingError: shape({
listingId: propTypes.uuid.isRequired,
@@ -209,10 +201,9 @@ const mapStateToProps = state => {
closingListingError,
} = state.ManageListingsPage;
const listings = getListingsById(state, currentPageResultIds);
- // Page needs authInfoError and logoutError
- const { authInfoError, logoutError } = state.Auth;
+ // Page needs logoutError
+ const { logoutError } = state.Auth;
return {
- authInfoError,
currentPageResultIds,
listings,
logoutError,
diff --git a/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap b/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap
index deb31332..eac413ad 100644
--- a/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap
+++ b/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`ContactDetailsPage matches snapshot 1`] = `
+
@@ -80,7 +75,6 @@ export class NotFoundPageComponent extends Component {
}
NotFoundPageComponent.defaultProps = {
- authInfoError: null,
logoutError: null,
staticContext: {},
};
@@ -88,7 +82,6 @@ NotFoundPageComponent.defaultProps = {
const { bool, func, object, shape } = PropTypes;
NotFoundPageComponent.propTypes = {
- authInfoError: propTypes.error,
logoutError: propTypes.error,
scrollingDisabled: bool.isRequired,
@@ -105,10 +98,9 @@ NotFoundPageComponent.propTypes = {
};
const mapStateToProps = state => {
- // Page needs authInfoError and logoutError
- const { authInfoError, logoutError } = state.Auth;
+ // Page needs logoutError
+ const { logoutError } = state.Auth;
return {
- authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
};
diff --git a/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap b/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap
index 5d4eb3da..e44458a2 100644
--- a/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap
+++ b/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`NotFoundPageComponent matches snapshot 1`] = `
{
const {
- authInfoError,
currentUser,
fetchOrderError,
intl,
@@ -77,7 +76,6 @@ export const OrderPageComponent = props => {
return (
{
};
OrderPageComponent.defaultProps = {
- authInfoError: null,
currentUser: null,
fetchOrderError: null,
logoutError: null,
@@ -106,7 +103,6 @@ OrderPageComponent.defaultProps = {
const { bool, oneOf, shape, string } = PropTypes;
OrderPageComponent.propTypes = {
- authInfoError: propTypes.error,
currentUser: propTypes.currentUser,
fetchOrderError: propTypes.error,
intl: intlShape.isRequired,
@@ -119,13 +115,12 @@ OrderPageComponent.propTypes = {
const mapStateToProps = state => {
const { fetchOrderError, transactionRef } = state.OrderPage;
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const { currentUser } = state.user;
const transactions = getMarketplaceEntities(state, transactionRef ? [transactionRef] : []);
const transaction = transactions.length > 0 ? transactions[0] : null;
return {
- authInfoError,
currentUser,
fetchOrderError,
logoutError,
diff --git a/src/containers/OrderPage/__snapshots__/OrderPage.test.js.snap b/src/containers/OrderPage/__snapshots__/OrderPage.test.js.snap
index aacc3b44..040bb2ca 100644
--- a/src/containers/OrderPage/__snapshots__/OrderPage.test.js.snap
+++ b/src/containers/OrderPage/__snapshots__/OrderPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`OrderPage matches snapshot 1`] = `
{
const {
- authInfoError,
changePasswordError,
changePasswordInProgress,
currentUser,
@@ -65,12 +64,7 @@ export const PasswordChangePageComponent = props => {
) : null;
return (
-
+
{
};
PasswordChangePageComponent.defaultProps = {
- authInfoError: null,
changePasswordError: null,
currentUser: null,
logoutError: null,
@@ -109,7 +102,6 @@ PasswordChangePageComponent.defaultProps = {
const { bool, func } = PropTypes;
PasswordChangePageComponent.propTypes = {
- authInfoError: propTypes.error,
changePasswordError: propTypes.error,
changePasswordInProgress: bool.isRequired,
currentUser: propTypes.currentUser,
@@ -121,8 +113,8 @@ PasswordChangePageComponent.propTypes = {
};
const mapStateToProps = state => {
- // Page needs authInfoError and logoutError
- const { authInfoError, logoutError } = state.Auth;
+ // Page needs logoutError
+ const { logoutError } = state.Auth;
// Topbar needs user info.
const {
changePasswordError,
@@ -131,7 +123,6 @@ const mapStateToProps = state => {
} = state.PasswordChangePage;
const { currentUser } = state.user;
return {
- authInfoError,
changePasswordError,
changePasswordInProgress,
currentUser,
diff --git a/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap b/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap
index 7141ba68..382b6dff 100644
--- a/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap
+++ b/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap
@@ -2,7 +2,6 @@
exports[`PasswordChangePage matches snapshot 1`] = `
{
const {
- authInfoError,
logoutError,
initialEmail,
submittedEmail,
@@ -160,7 +159,7 @@ export const PasswordRecoveryPageComponent = props => {
}
return (
-
+
@@ -177,7 +176,6 @@ export const PasswordRecoveryPageComponent = props => {
};
PasswordRecoveryPageComponent.defaultProps = {
- authInfoError: null,
logoutError: null,
sendVerificationEmailError: null,
initialEmail: null,
@@ -188,7 +186,6 @@ PasswordRecoveryPageComponent.defaultProps = {
const { bool, func, string } = PropTypes;
PasswordRecoveryPageComponent.propTypes = {
- authInfoError: propTypes.error,
logoutError: propTypes.error,
initialEmail: string,
submittedEmail: string,
@@ -204,8 +201,8 @@ PasswordRecoveryPageComponent.propTypes = {
};
const mapStateToProps = state => {
- // Page needs authInfoError and logoutError
- const { authInfoError, logoutError } = state.Auth;
+ // Page needs logoutError
+ const { logoutError } = state.Auth;
const {
initialEmail,
@@ -215,7 +212,6 @@ const mapStateToProps = state => {
passwordRequested,
} = state.PasswordRecoveryPage;
return {
- authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
initialEmail,
diff --git a/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap b/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap
index e0cafdf2..0ae0b29c 100644
--- a/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap
+++ b/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`ContactDetailsPage matches snapshot 1`] = `
diff --git a/src/containers/PasswordResetPage/PasswordResetPage.js b/src/containers/PasswordResetPage/PasswordResetPage.js
index 5d534536..b44f4b25 100644
--- a/src/containers/PasswordResetPage/PasswordResetPage.js
+++ b/src/containers/PasswordResetPage/PasswordResetPage.js
@@ -36,7 +36,6 @@ export class PasswordResetPageComponent extends Component {
}
render() {
const {
- authInfoError,
intl,
logoutError,
scrollingDisabled,
@@ -122,12 +121,7 @@ export class PasswordResetPageComponent extends Component {
}
return (
-
+
@@ -145,7 +139,6 @@ export class PasswordResetPageComponent extends Component {
}
PasswordResetPageComponent.defaultProps = {
- authInfoError: null,
logoutError: null,
resetPasswordError: null,
};
@@ -153,7 +146,6 @@ PasswordResetPageComponent.defaultProps = {
const { bool, func, shape, string } = PropTypes;
PasswordResetPageComponent.propTypes = {
- authInfoError: propTypes.error,
logoutError: propTypes.error,
scrollingDisabled: bool.isRequired,
resetPasswordInProgress: bool.isRequired,
@@ -170,10 +162,9 @@ PasswordResetPageComponent.propTypes = {
};
const mapStateToProps = state => {
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const { resetPasswordInProgress, resetPasswordError } = state.PasswordResetPage;
return {
- authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
resetPasswordInProgress,
diff --git a/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js b/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js
index 7e7f588c..2b784fbc 100644
--- a/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js
+++ b/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js
@@ -15,11 +15,10 @@ import {
import { TopbarContainer } from '../../containers';
export const PayoutPreferencesPageComponent = props => {
- const { authInfoError, logoutError, scrollingDisabled } = props;
+ const { logoutError, scrollingDisabled } = props;
return (
{
};
PayoutPreferencesPageComponent.defaultProps = {
- authInfoError: null,
logoutError: null,
};
const { bool } = PropTypes;
PayoutPreferencesPageComponent.propTypes = {
- authInfoError: propTypes.error,
logoutError: propTypes.error,
scrollingDisabled: bool.isRequired,
};
const mapStateToProps = state => {
- // Page needs authInfoError and logoutError
- const { authInfoError, logoutError } = state.Auth;
+ // Page needs logoutError
+ const { logoutError } = state.Auth;
return {
- authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
};
diff --git a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap
index 558797ae..d15749ae 100644
--- a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap
+++ b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`PayoutPreferencesPage matches snapshot 1`] = `
{
- const { authInfoError, logoutError, params, scrollingDisabled } = props;
+ const { logoutError, params, scrollingDisabled } = props;
return (
{
};
ProfilePageComponent.defaultProps = {
- authInfoError: null,
logoutError: null,
};
const { bool, shape, string } = PropTypes;
ProfilePageComponent.propTypes = {
- authInfoError: propTypes.error,
logoutError: propTypes.error,
params: shape({ displayName: string.isRequired }).isRequired,
scrollingDisabled: bool.isRequired,
};
const mapStateToProps = state => {
- // Page needs authInfoError and logoutError
- const { authInfoError, logoutError } = state.Auth;
+ // Page needs logoutError
+ const { logoutError } = state.Auth;
return {
- authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
};
diff --git a/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap b/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap
index 6636aea6..c8f7a0b0 100644
--- a/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap
+++ b/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap
@@ -2,7 +2,6 @@
exports[`ProfilePage matches snapshot 1`] = `
{
- // Page needs authInfoError and logoutError
- const { authInfoError, logoutError } = state.Auth;
+ // Page needs logoutError
+ const { logoutError } = state.Auth;
const { currentUser } = state.user;
const {
image,
@@ -164,7 +160,6 @@ const mapStateToProps = state => {
updateProfileError,
} = state.ProfileSettingsPage;
return {
- authInfoError,
currentUser,
image,
logoutError,
diff --git a/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap b/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap
index e18e2abd..b5285e8c 100644
--- a/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap
+++ b/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`ContactDetailsPage matches snapshot 1`] = `
{
const {
- authInfoError,
currentUser,
fetchSaleError,
acceptSaleError,
@@ -99,7 +98,6 @@ export const SalePageComponent = props => {
return (
{
};
SalePageComponent.defaultProps = {
- authInfoError: null,
currentUser: null,
fetchSaleError: null,
acceptSaleError: null,
@@ -132,7 +129,6 @@ SalePageComponent.defaultProps = {
const { bool, func, oneOf, shape, string } = PropTypes;
SalePageComponent.propTypes = {
- authInfoError: propTypes.error,
currentUser: propTypes.currentUser,
fetchSaleError: propTypes.error,
acceptSaleError: propTypes.error,
@@ -158,14 +154,13 @@ const mapStateToProps = state => {
declineInProgress,
transactionRef,
} = state.SalePage;
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const { currentUser } = state.user;
const transactions = getMarketplaceEntities(state, transactionRef ? [transactionRef] : []);
const transaction = transactions.length > 0 ? transactions[0] : null;
return {
- authInfoError,
currentUser,
fetchSaleError,
acceptSaleError,
diff --git a/src/containers/SalePage/__snapshots__/SalePage.test.js.snap b/src/containers/SalePage/__snapshots__/SalePage.test.js.snap
index ec5b9f9f..b0625f83 100644
--- a/src/containers/SalePage/__snapshots__/SalePage.test.js.snap
+++ b/src/containers/SalePage/__snapshots__/SalePage.test.js.snap
@@ -2,7 +2,6 @@
exports[`SalePage matches snapshot 1`] = `
{
searchParams,
searchMapListingIds,
} = state.SearchPage;
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
const pageListings = getListingsById(state, currentPageResultIds);
const mapListings = getListingsById(
state,
@@ -397,7 +393,6 @@ const mapStateToProps = state => {
);
return {
- authInfoError,
listings: pageListings,
logoutError,
mapListings,
diff --git a/src/containers/SearchPage/__snapshots__/SearchPage.test.js.snap b/src/containers/SearchPage/__snapshots__/SearchPage.test.js.snap
index 27559636..757d8b1b 100644
--- a/src/containers/SearchPage/__snapshots__/SearchPage.test.js.snap
+++ b/src/containers/SearchPage/__snapshots__/SearchPage.test.js.snap
@@ -2,7 +2,6 @@
exports[`SearchPageComponent matches snapshot 1`] = `
{
- const { authInfoError, logoutError } = state.Auth;
+ const { logoutError } = state.Auth;
return {
- authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
};
diff --git a/src/ducks/Auth.duck.js b/src/ducks/Auth.duck.js
index 5705062d..606268ab 100644
--- a/src/ducks/Auth.duck.js
+++ b/src/ducks/Auth.duck.js
@@ -2,13 +2,12 @@ import { clearCurrentUser, fetchCurrentUser } from './user.duck';
import { storableError } from '../util/errors';
import * as log from '../util/log';
-const authenticated = authInfo => authInfo.grantType === 'refresh_token';
+const authenticated = authInfo => authInfo && authInfo.grantType === 'refresh_token';
// ================ Action types ================ //
export const AUTH_INFO_REQUEST = 'app/Auth/AUTH_INFO_REQUEST';
export const AUTH_INFO_SUCCESS = 'app/Auth/AUTH_INFO_SUCCESS';
-export const AUTH_INFO_ERROR = 'app/Auth/AUTH_INFO_ERROR';
export const LOGIN_REQUEST = 'app/Auth/LOGIN_REQUEST';
export const LOGIN_SUCCESS = 'app/Auth/LOGIN_SUCCESS';
@@ -33,7 +32,6 @@ const initialState = {
// auth info
authInfoLoaded: false,
- authInfoError: null,
// login
loginError: null,
@@ -52,12 +50,9 @@ export default function reducer(state = initialState, action = {}) {
const { type, payload } = action;
switch (type) {
case AUTH_INFO_REQUEST:
- return { ...state, authInfoError: null };
+ return state;
case AUTH_INFO_SUCCESS:
return { ...state, authInfoLoaded: true, isAuthenticated: authenticated(payload) };
- case AUTH_INFO_ERROR:
- console.error(payload); // eslint-disable-line
- return { ...state, authInfoLoaded: true, authInfoError: payload };
case LOGIN_REQUEST:
return {
@@ -102,7 +97,6 @@ export const authenticationInProgress = state => {
export const authInfoRequest = () => ({ type: AUTH_INFO_REQUEST });
export const authInfoSuccess = info => ({ type: AUTH_INFO_SUCCESS, payload: info });
-export const authInfoError = error => ({ type: AUTH_INFO_ERROR, payload: error, error: true });
export const loginRequest = () => ({ type: LOGIN_REQUEST });
export const loginSuccess = () => ({ type: LOGIN_SUCCESS });
@@ -125,7 +119,15 @@ export const authInfo = () => (dispatch, getState, sdk) => {
return sdk
.authInfo()
.then(info => dispatch(authInfoSuccess(info)))
- .catch(e => dispatch(authInfoError(storableError(e))));
+ .catch(e => {
+ // Requesting auth info just reads the token from the token
+ // store (i.e. cookies), and should not fail in normal
+ // circumstances. If it fails, it's due to a programming
+ // error. In that case we mark the operation done and dispatch
+ // `null` success action that marks the user as unauthenticated.
+ log.error(e, 'auth-info-failed');
+ dispatch(authInfoSuccess(null));
+ });
};
export const login = (username, password) => (dispatch, getState, sdk) => {
diff --git a/src/ducks/Auth.test.js b/src/ducks/Auth.test.js
index 9865290a..d1a79c28 100644
--- a/src/ducks/Auth.test.js
+++ b/src/ducks/Auth.test.js
@@ -3,7 +3,6 @@ import { clearCurrentUser, currentUserShowRequest, currentUserShowSuccess } from
import reducer, {
authenticationInProgress,
authInfoSuccess,
- authInfoError,
login,
loginRequest,
loginSuccess,
@@ -51,7 +50,6 @@ describe('Auth duck', () => {
const state = reducer();
expect(state.isAuthenticated).toEqual(false);
expect(state.authInfoLoaded).toEqual(false);
- expect(state.authInfoError).toBeNull();
expect(state.loginError).toBeNull();
expect(state.logoutError).toBeNull();
expect(state.signupError).toBeNull();
@@ -165,7 +163,6 @@ describe('Auth duck', () => {
const state = reducer(initialState, authInfoSuccess(authInfoLoggedOut));
expect(state.authInfoLoaded).toEqual(true);
expect(state.isAuthenticated).toEqual(false);
- expect(state.authInfoError).toBeNull();
});
it('should set initial state for anonymous users', () => {
@@ -175,7 +172,6 @@ describe('Auth duck', () => {
const state = reducer(initialState, authInfoSuccess(authInfoAnonymous));
expect(state.authInfoLoaded).toEqual(true);
expect(state.isAuthenticated).toEqual(false);
- expect(state.authInfoError).toBeNull();
});
it('should set initial state for unauthenticated users', () => {
@@ -185,7 +181,6 @@ describe('Auth duck', () => {
const state = reducer(initialState, authInfoSuccess(authInfoLoggedIn));
expect(state.authInfoLoaded).toEqual(true);
expect(state.isAuthenticated).toEqual(true);
- expect(state.authInfoError).toBeNull();
});
});
diff --git a/src/translations/en.json b/src/translations/en.json
index da6e5808..a62a09a0 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -276,7 +276,6 @@
"OrderPage.fetchOrderFailed": "Fetching order data failed.",
"OrderPage.loadingData": "Loading order data.",
"OrderPage.title": "Order details: {listingTitle}",
- "Page.authInfoFailed": "Could not get authentication information.",
"Page.logoutFailed": "Logout failed. Please try again.",
"Page.schemaDescription": "You can book a sauna from Saunatime or get some income by sharing your own sauna",
"Page.schemaTitle": "Book saunas everywhere | {siteTitle}",