Update the store after setting an authorized address
[MAILPOET-2681]
This commit is contained in:
committed by
Veljko V
parent
9877ed3573
commit
af4225bc87
@@ -66,9 +66,10 @@ const removeUnauthorizedEmailNotices = () => {
|
||||
|
||||
type Props = {
|
||||
onRequestClose: () => void,
|
||||
setAuthorizedAddress: (address: string) => any,
|
||||
};
|
||||
|
||||
const SetFromAddressModal = ({ onRequestClose }: Props) => {
|
||||
const SetFromAddressModal = ({ onRequestClose, setAuthorizedAddress }: Props) => {
|
||||
const [address, setAddress] = useState(null);
|
||||
const { notices } = React.useContext<any>(GlobalContext);
|
||||
|
||||
@@ -125,6 +126,7 @@ const SetFromAddressModal = ({ onRequestClose }: Props) => {
|
||||
}
|
||||
try {
|
||||
await handleSave(address);
|
||||
setAuthorizedAddress(address);
|
||||
onRequestClose();
|
||||
removeUnauthorizedEmailNotices();
|
||||
notices.success(getSuccessMessage(), { timeout: false });
|
||||
|
@@ -16,8 +16,13 @@ export default function KeyActivation() {
|
||||
const verifyPremiumKey = useAction('verifyPremiumKey');
|
||||
const installPremiumPlugin = useAction('installPremiumPlugin');
|
||||
const activatePremiumPlugin = useAction('activatePremiumPlugin');
|
||||
const [senderAddress] = useSetting('sender', 'address');
|
||||
const [unauthorizedAddresses] = useSetting('authorized_emails_addresses_check');
|
||||
const [senderAddress, setSenderAddress] = useSetting('sender', 'address');
|
||||
const [unauthorizedAddresses, setUnauthorizedAddresses] = useSetting('authorized_emails_addresses_check');
|
||||
|
||||
const setAuthorizedAddress = async (address: string) => {
|
||||
await setSenderAddress(address);
|
||||
await setUnauthorizedAddresses(null);
|
||||
};
|
||||
|
||||
const verifyKey = async (event) => {
|
||||
if (!state.key) {
|
||||
@@ -94,6 +99,7 @@ export default function KeyActivation() {
|
||||
{state.showFromAddressModal && (
|
||||
<SetFromAddressModal
|
||||
onRequestClose={() => setState({ showFromAddressModal: false })}
|
||||
setAuthorizedAddress={setAuthorizedAddress}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user