Automatically activate MSS after key activation
[MAILPOET-2431]
This commit is contained in:
committed by
Jack Kitterhing
parent
7a35d0276d
commit
014e6be4dc
@ -23,6 +23,22 @@ const requestServicesApi = async (key, action) => MailPoet.Ajax.post({
|
||||
data: { key },
|
||||
});
|
||||
|
||||
const activateMss = async (key) => MailPoet.Ajax.post({
|
||||
api_version: window.mailpoet_api_version,
|
||||
endpoint: 'settings',
|
||||
action: 'set',
|
||||
data: {
|
||||
mta_group: 'mailpoet',
|
||||
mta: {
|
||||
method: 'MailPoet',
|
||||
mailpoet_api_key: key,
|
||||
},
|
||||
signup_confirmation: {
|
||||
enabled: '1',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const PremiumTab = (props) => {
|
||||
const [key, setKey] = useState(props.activationKey);
|
||||
const [premiumStatus, setPremiumStatus] = useState(key ? props.premiumStatus : null);
|
||||
@ -114,6 +130,8 @@ const PremiumTab = (props) => {
|
||||
const response = await requestServicesApi(key, 'checkMSSKey');
|
||||
setMssKeyValid(true);
|
||||
setMssKeyMessage(response.data.message || null);
|
||||
|
||||
await activateMss(key);
|
||||
} catch (error) {
|
||||
setMssKeyValid(false);
|
||||
setMssKeyMessage(error.errors.map((e) => e.message).join(' ') || null);
|
||||
|
Reference in New Issue
Block a user