Allow multiple screens to have the same URL as long as role is different
This commit is contained in:
parent
e5a34871c7
commit
7768b9ace8
|
@ -48,10 +48,10 @@
|
||||||
|
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
if (!route) {
|
if (!route) {
|
||||||
routeError = "Url is required"
|
routeError = "URL is required"
|
||||||
} else {
|
} else {
|
||||||
if (routeNameExists(route)) {
|
if (routeExists(route, roleId)) {
|
||||||
routeError = "This url is already taken"
|
routeError = "This URL is already taken for this access role"
|
||||||
} else {
|
} else {
|
||||||
routeError = ""
|
routeError = ""
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,11 @@
|
||||||
$goto(`./${createdScreen._id}`)
|
$goto(`./${createdScreen._id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const routeNameExists = route => {
|
const routeExists = (route, roleId) => {
|
||||||
return $allScreens.some(
|
return $allScreens.some(
|
||||||
screen => screen.routing.route.toLowerCase() === route.toLowerCase()
|
screen =>
|
||||||
|
screen.routing.route.toLowerCase() === route.toLowerCase() &&
|
||||||
|
screen.routing.roleId === roleId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue