Resolve no shop access.
This commit is contained in:
@@ -12186,6 +12186,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>noshop</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>notfoundsub</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
12
client/src/components/no-shop/no-shop.component.jsx
Normal file
12
client/src/components/no-shop/no-shop.component.jsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from "react";
|
||||
import { Result } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function NoShop() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div>
|
||||
<Result status="403" title={t("general.messages.noshop")} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -7,12 +7,17 @@ import { setBodyshop } from "../../redux/user/user.actions";
|
||||
import ManagePage from "./manage.page.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import NoShop from "../../components/no-shop/no-shop.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop });
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBodyshop: (bs) => dispatch(setBodyshop(bs)),
|
||||
});
|
||||
|
||||
function ManagePageContainer({ match, setBodyshop }) {
|
||||
function ManagePageContainer({ match, setBodyshop, bodyshop }) {
|
||||
const { loading, error, data } = useQuery(QUERY_BODYSHOP, {
|
||||
fetchPolicy: "network-only",
|
||||
});
|
||||
@@ -20,13 +25,19 @@ function ManagePageContainer({ match, setBodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
if (data) setBodyshop(data.bodyshops[0]);
|
||||
if (data) setBodyshop(data.bodyshops[0] || { notfound: true });
|
||||
}, [data, setBodyshop]);
|
||||
|
||||
if (loading)
|
||||
return <LoadingSpinner message={t("general.labels.loadingshop")} />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
if (bodyshop && bodyshop.notfound) return <NoShop />;
|
||||
|
||||
return <ManagePage match={match} />;
|
||||
}
|
||||
|
||||
export default connect(null, mapDispatchToProps)(ManagePageContainer);
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ManagePageContainer);
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
sendPasswordResetSuccess,
|
||||
setAuthlevel,
|
||||
setInstanceConflict,
|
||||
setInstanceId,
|
||||
setLocalFingerprint,
|
||||
signInFailure,
|
||||
signInSuccess,
|
||||
@@ -160,7 +159,7 @@ export function* onSignInSuccess() {
|
||||
export function* signInSuccessSaga({ payload }) {
|
||||
LogRocket.identify(payload.email);
|
||||
|
||||
if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
|
||||
// if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
|
||||
analytics.setUserId(payload.email);
|
||||
analytics.setUserProperties(payload);
|
||||
yield logImEXEvent("redux_sign_in_success");
|
||||
@@ -177,7 +176,7 @@ export function* sendPasswordResetEmail({ payload }) {
|
||||
yield auth.sendPasswordResetEmail(payload, {
|
||||
url: "https://imex.online/passwordreset",
|
||||
});
|
||||
console.log("Good should send.");
|
||||
|
||||
yield put(sendPasswordResetSuccess());
|
||||
} catch (error) {
|
||||
yield put(sendPasswordResetFailure(error.message));
|
||||
|
||||
@@ -782,6 +782,7 @@
|
||||
"newversionmessage": "Click refresh below to update to the latest available version of ImEX Online.",
|
||||
"newversiontitle": "New version of ImEX Online Available",
|
||||
"noacctfilepath": "There is no accounting file path set. You will not be able to export any items.",
|
||||
"noshop": "You do not have access to any shops. Please reach out to your shop manager or technical support. ",
|
||||
"notfoundsub": "Please make sure that you have access to the data or that the link is correct.",
|
||||
"notfoundtitle": "We couldn't find what you're looking for...",
|
||||
"partnernotrunning": "ImEX Online has detected that the partner is not running. Please ensure it is running to enable full functionality.",
|
||||
|
||||
@@ -782,6 +782,7 @@
|
||||
"newversionmessage": "",
|
||||
"newversiontitle": "",
|
||||
"noacctfilepath": "",
|
||||
"noshop": "",
|
||||
"notfoundsub": "",
|
||||
"notfoundtitle": "",
|
||||
"partnernotrunning": "",
|
||||
|
||||
@@ -782,6 +782,7 @@
|
||||
"newversionmessage": "",
|
||||
"newversiontitle": "",
|
||||
"noacctfilepath": "",
|
||||
"noshop": "",
|
||||
"notfoundsub": "",
|
||||
"notfoundtitle": "",
|
||||
"partnernotrunning": "",
|
||||
|
||||
Reference in New Issue
Block a user