extractRoute.tsx 372 B

1234567891011121314
  1. import {Location} from 'history';
  2. export function extractRoute(location: Location) {
  3. if (location.pathname.match(/^\/starfish\/api\//)) {
  4. return 'api';
  5. }
  6. if (location.pathname.match(/^\/starfish\/database\//)) {
  7. return 'database';
  8. }
  9. if (location.pathname.match(/^\/starfish\/endpoint-overview\//)) {
  10. return 'endpoint-overview';
  11. }
  12. return null;
  13. }