af83/chouette-core

View on GitHub
app/packs/src/helpers/url_params.js

Summary

Maintainability
A
0 mins
Test Coverage
export const getId = type => {
  const match = window.location.pathname.match(new RegExp(`${type}\/([0-9]+)`))

  return match ? match[1] : null
}

export const getWorkgroupId = () => getId('workgroups')
export const getWorkbenchId = () => getId('workbenches')
export const getReferentialId = () => getId('referentials')
export const getLineId = () => getId('lines')
export const getRouteId = () => getId('routes')