feat: add dynamic routing (#25)
Some checks failed
it-academy/dry-wash-pl/pipeline/pr-main There was a failure building this commit
it-academy/dry-wash-pl/pipeline/head There was a failure building this commit

This commit is contained in:
2024-11-24 14:50:51 +03:00
parent c2fad8a3ff
commit dee3a04310
5 changed files with 89 additions and 52 deletions

View File

@@ -1,25 +1,40 @@
import { generatePath } from "react-router-dom";
import { getNavigationValue } from "@brojs/cli";
import { generatePath } from 'react-router-dom';
import { getNavigationValue } from '@brojs/cli';
import { Order } from "../models";
import { Order } from '../models';
const getFullUrls = (url: string) =>
`${getNavigationValue('dry-wash.main')}${url}`;
export const URLs = {
landing: {
url: getNavigationValue("dry-wash.main"),
url: getNavigationValue('dry-wash.main'),
getUrl() {
return this.url;
}
},
},
orderForm: {
url: getNavigationValue("dry-wash.create"),
url: getNavigationValue('dry-wash.create'),
getUrl() {
return this.url;
}
},
},
orderView: {
url: getNavigationValue("dry-wash.view.order"),
url: getNavigationValue('dry-wash.view.order'),
getUrl(orderId: Order.Id) {
return generatePath(this.url, { orderId });
}
}
};
},
},
armMaster: {
url: getNavigationValue('dry-wash.arm.master'),
isOn: Boolean(getNavigationValue('dry-wash.arm.master')),
},
armOrder: {
url: getNavigationValue('dry-wash.arm.order'),
isOn: Boolean(getNavigationValue('dry-wash.arm.order')),
},
armBase: {
url: getFullUrls(getNavigationValue('dry-wash.arm')),
isOn: Boolean(getNavigationValue('dry-wash.arm')),
},
};