Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions imports/plugins/core/layout/client/components/coreLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Logger from "/client/modules/logger";
import { Meteor } from "meteor/meteor";
import Button from "@material-ui/core/Button";
import withStyles from "@material-ui/core/styles/withStyles";
import InlineAlert from "@reactioncommerce/components/InlineAlert/v1";
import ShopLogo from "/imports/client/ui/components/ShopLogoWithData/ShopLogoWithData";

const styles = (theme) => ({
Expand Down Expand Up @@ -82,6 +83,24 @@ function CoreLayout({ classes, isAdmin, isLoading, isLoggedIn, location, storefr
}
}

// If user is logged in, and they come from storefront (/account in url)
// redirect to storefront
if (location.pathname.startsWith("/account") && isLoggedIn) {
if (storefrontHomeUrl && storefrontHomeUrl.length) {
window.location.href = storefrontHomeUrl;
return null;
}

Logger.warn("Missing storefront home URL. Please set this from the shop settings panel so that customer users can be redirected to your storefront.");

content = (
<InlineAlert
alertType="error"
message="Missing storefront home URL. Please set this from the shop settings panel so that customer users can be redirected to your storefront."
/>
);
}

return (
<div id="reactionAppContainer">
<div className={classes.root}>
Expand Down