File tree Expand file tree Collapse file tree 4 files changed +10
-12
lines changed Expand file tree Collapse file tree 4 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export const DECODE_ROUTES = {
2222
2323export const ROUTES = {
2424 UNSUBSCRIBE : '/goal-unsubscribe/:token' ,
25- PREFERENCES_UNSUBSCRIBE : '/preferences-unsubscribe/:userToken/:updatePatch' ,
25+ PREFERENCES_UNSUBSCRIBE : '/preferences-unsubscribe/:userToken/:updatePatch? ' ,
2626 REDIRECT : '/redirect/*' ,
2727 DASHBOARD : 'dashboard' ,
2828 ENTERPRISE_LEARNER_DASHBOARD : 'enterprise-learner-dashboard' ,
Original file line number Diff line number Diff line change 11import { getConfig } from '@edx/frontend-platform' ;
22import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth' ;
33
4- export const getUnsubscribeUrl = ( userToken , updatePatch ) => (
5- `${ getConfig ( ) . LMS_BASE_URL } /api/notifications/preferences/update/${ userToken } /${ updatePatch } / `
4+ export const getUnsubscribeUrl = ( userToken ) => (
5+ `${ getConfig ( ) . LMS_BASE_URL } /api/notifications/preferences/update/${ userToken } /`
66) ;
77
8- export async function unsubscribeNotificationPreferences ( userToken , updatePatch ) {
9- const url = getUnsubscribeUrl ( userToken , updatePatch ) ;
8+ export async function unsubscribeNotificationPreferences ( userToken ) {
9+ const url = getUnsubscribeUrl ( userToken ) ;
1010 return getAuthenticatedHttpClient ( ) . get ( url ) ;
1111}
Original file line number Diff line number Diff line change @@ -17,18 +17,18 @@ import messages from './messages';
1717
1818const PreferencesUnsubscribe = ( ) => {
1919 const intl = useIntl ( ) ;
20- const { userToken, updatePatch } = useParams ( ) ;
20+ const { userToken } = useParams ( ) ;
2121 const [ status , setStatus ] = useState ( LOADING ) ;
2222
2323 useEffect ( ( ) => {
24- unsubscribeNotificationPreferences ( userToken , updatePatch ) . then (
24+ unsubscribeNotificationPreferences ( userToken ) . then (
2525 ( ) => setStatus ( LOADED ) ,
2626 ( error ) => {
2727 setStatus ( FAILED ) ;
2828 logError ( error ) ;
2929 } ,
3030 ) ;
31- sendTrackEvent ( 'edx.ui.lms.notifications.preferences.unsubscribe' , { userToken, updatePatch } ) ;
31+ sendTrackEvent ( 'edx.ui.lms.notifications.preferences.unsubscribe' , { userToken } ) ;
3232 } , [ ] ) ;
3333
3434 const pageContent = {
Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ describe('Notification Preferences One Click Unsubscribe', () => {
2424 let component ;
2525 let store ;
2626 const userToken = '1234' ;
27- const updatePatch = 'abc123' ;
28- const url = getUnsubscribeUrl ( userToken , updatePatch ) ;
27+ const url = getUnsubscribeUrl ( userToken ) ;
2928
3029 beforeAll ( async ( ) => {
3130 await initializeTestStore ( ) ;
@@ -39,7 +38,7 @@ describe('Notification Preferences One Click Unsubscribe', () => {
3938 component = (
4039 < AppProvider store = { store } wrapWithRouter = { false } >
4140 < UserMessagesProvider >
42- < MemoryRouter initialEntries = { [ `${ `/preferences-unsubscribe/${ userToken } /${ updatePatch } / ` } ` ] } >
41+ < MemoryRouter initialEntries = { [ `${ `/preferences-unsubscribe/${ userToken } /` } ` ] } >
4342 < Routes >
4443 < Route path = { ROUTES . PREFERENCES_UNSUBSCRIBE } element = { < PreferencesUnsubscribe /> } />
4544 </ Routes >
@@ -69,7 +68,6 @@ describe('Notification Preferences One Click Unsubscribe', () => {
6968 expect ( screen . getByTestId ( 'heading-text' ) ) . toHaveTextContent ( 'Error unsubscribing from preference' ) ;
7069 expect ( sendTrackEvent ) . toHaveBeenCalledWith ( 'edx.ui.lms.notifications.preferences.unsubscribe' , {
7170 userToken,
72- updatePatch,
7371 } ) ;
7472 } ) ;
7573} ) ;
You can’t perform that action at this time.
0 commit comments