Skip to content

Commit

Permalink
f-account-info@v0.24.0 - Dynamically generate return URL (#1929)
Browse files Browse the repository at this point in the history
* f-account-info@v0.24.0

* f-account-info@v0.24.0 - Switch to fullPath to capture query

* f-account-info@v0.25.0 - Bump version

Co-authored-by: Thomas William McClean <thomas.mcclean@justeattakeaway.com>
  • Loading branch information
tommcclean and Thomas William McClean authored Jun 14, 2022
1 parent 4a92237 commit ce7f65e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions packages/components/pages/f-account-info/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

v0.25.0
------------------------------
*June 14 2022*

### Changed
- Dynamically determine returnUrl for the change password link using $route


v0.24.0
------------------------------
Expand Down
2 changes: 1 addition & 1 deletion packages/components/pages/f-account-info/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@justeat/f-account-info",
"description": "Fozzie Account Info - The account information page",
"version": "0.24.0",
"version": "0.25.0",
"main": "dist/f-account-info.umd.min.js",
"maxBundleSize": "100kB",
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
:class="[$style['c-accountInfo-changePasswordButton']]"
data-test-id="account-info-change-password-button"
button-type="secondary"
href="/account/change-password?returnurl=/account/info"
:href="changePasswordUrl"
button-size="large"
is-full-width
action-type="submit">
Expand Down Expand Up @@ -303,7 +303,13 @@ export default {
computed: {
...mapState('fAccountInfoModule', [
'consumer'
])
]),
changePasswordUrl () {
const returnUrlPath = encodeURIComponent(this.$route.fullPath);
return `/account/change-password?returnUrl=${returnUrlPath}`;
}
},
watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ describe('AccountInfo', () => {
$http: httpSpy,
$cookies: cookiesSpy,
$log: logMocks,
$route: {
fullPath: '/account/info'
},
$gtm: {
pushEvent: pushEventSpy
},
Expand Down Expand Up @@ -304,7 +307,7 @@ describe('AccountInfo', () => {
const element = wrapper.find('[data-test-id="account-info-change-password-button"]');

// Assert
expect(element.attributes('href')).toBe('/account/change-password?returnurl=/account/info');
expect(element.attributes('href')).toBe('/account/change-password?returnUrl=%2Faccount%2Finfo');
});
});

Expand Down

0 comments on commit ce7f65e

Please sign in to comment.