mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Wired unsubscribe all button for newsletter preference page
This commit is contained in:
parent
252e6d4523
commit
e0e6f48fc8
1 changed files with 11 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
import AppContext from '../../AppContext';
|
||||
import CloseButton from '../common/CloseButton';
|
||||
import BackButton from '../common/BackButton';
|
||||
import {useContext, useState} from 'react';
|
||||
import {useContext, useEffect, useState} from 'react';
|
||||
import Switch from '../common/Switch';
|
||||
import {getSiteNewsletters} from '../../utils/helpers';
|
||||
import ActionButton from '../common/ActionButton';
|
||||
|
@ -68,6 +68,9 @@ export default function AccountEmailPage() {
|
|||
const {brandColor, member, onAction} = useContext(AppContext);
|
||||
const defaultSubscribedNewsletters = [...(member.newsletters || [])];
|
||||
const [subscribedNewsletters, setSubscribedNewsletters] = useState(defaultSubscribedNewsletters);
|
||||
useEffect(() => {
|
||||
setSubscribedNewsletters(member.newsletters);
|
||||
}, [member.newsletters]);
|
||||
|
||||
return (
|
||||
<div className='gh-portal-content with-footer'>
|
||||
|
@ -106,7 +109,13 @@ export default function AccountEmailPage() {
|
|||
</div>
|
||||
<ActionButton
|
||||
isRunning={false}
|
||||
onClick={(e) => {}}
|
||||
onClick={(e) => {
|
||||
onAction('showPopupNotification', {
|
||||
action: 'updated:success',
|
||||
message: `Newsletter preference updated.`
|
||||
});
|
||||
onAction('updateNewsletterPreference', {newsletters: []});
|
||||
}}
|
||||
disabled={false}
|
||||
brandColor={brandColor}
|
||||
isPrimary={false}
|
||||
|
|
Loading…
Add table
Reference in a new issue