add response interceptors for refreshTokens method

This commit is contained in:
Dzmitry_Tamashevich@epam.com
2020-11-23 22:27:36 +03:00
committed by Daniel Hutzel
parent 76cbf7f9ca
commit 938abb6387
53 changed files with 4702 additions and 4513 deletions

View File

@@ -0,0 +1,27 @@
import React from "react";
import { Redirect } from "react-router-dom";
import { useAppState } from "../hooks/useAppState";
const withRestrictions = (Component, isUserMeetRestrictions) => {
return (props) => {
const { user, invoicedItems } = useAppState();
return isUserMeetRestrictions({ user, invoicedItems }) ? (
<Component {...props} />
) : (
<Redirect exact to="/error" />
);
};
};
const withRestrictedSection = (Component, isUserMeetRestrictions) => {
return (props) => {
const { user, invoicedItems } = useAppState();
return (
isUserMeetRestrictions({ user, invoicedItems }) && (
<Component {...props} />
)
);
};
};
export { withRestrictions, withRestrictedSection };