Skip to content

Commit

Permalink
fix(billing): standardize and fix redirection to order tracking (#15290)
Browse files Browse the repository at this point in the history
ref: MANAGER-16966

Signed-off-by: Jacques Larique <[email protected]>
  • Loading branch information
JacquesLarique authored and Stephanie Moallic committed Feb 7, 2025
1 parent 0107ccf commit 692bd9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
19 changes: 1 addition & 18 deletions packages/manager/modules/new-billing/src/billing.routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,13 @@ import {
GUIDE_TRACKING_TAG,
} from './constants/guides-header.constants';

export default /* @ngInject */ (
$stateProvider,
$urlRouterProvider,
$urlServiceProvider,
) => {
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('billing', {
url: '',
translations: { value: ['.'], format: 'json' },
redirectTo: 'billing.main',
template,
controller,
onEnter: () => {
$urlServiceProvider.rules.when('/order/:id', '/orders/:id');

$urlRouterProvider.when(
/\/(credits|fidelity|mean|method|ovhaccount|vouchers)$/,
($location, $state) => {
const [, subroute] = $location.$$path.match(
/\/(credits|fidelity|mean|method|ovhaccount|vouchers)(\/.*)?/,
);
return $state.go(`billing.payment.${subroute}`);
},
);
},
resolve: {
denyEnterprise: ($q, $state, currentUser) => {
if (
Expand Down
15 changes: 14 additions & 1 deletion packages/manager/modules/new-billing/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ angular
ovhManagerAccountMigration,
])
.config(
/* @ngInject */ ($stateProvider) => {
/* @ngInject */ ($stateProvider, $urlRouterProvider) => {
$stateProvider.state('billing.**', {
url: '/',
lazyLoad: ($transition$) => {
Expand All @@ -68,6 +68,19 @@ angular
);
},
});
$urlRouterProvider.when('/order/:id', ($location) => {
$location.url($location.url().replace('/order', '/orders'));
});

$urlRouterProvider.when(
/\/(credits|fidelity|mean|method|ovhaccount|vouchers)$/,
($location, $state) => {
const [, subroute] = $location.$$path.match(
/\/(credits|fidelity|mean|method|ovhaccount|vouchers)(\/.*)?/,
);
return $state.go(`billing.payment.${subroute}`);
},
);
},
);

Expand Down

0 comments on commit 692bd9c

Please sign in to comment.