summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/search_autocomplete_utils.js
blob: a9a0f941e93c69ab28c1cf0f4d9bd46d4fa7c5c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { getPagePath } from './lib/utils/common_utils';

export const isInGroupsPage = () => getPagePath() === 'groups';

export const isInProjectPage = () => getPagePath() === 'projects';

export const getProjectSlug = () => {
  if (isInProjectPage()) {
    return document?.body?.dataset?.project;
  }
  return null;
};

export const getGroupSlug = () => {
  if (isInProjectPage() || isInGroupsPage()) {
    return document?.body?.dataset?.group;
  }
  return null;
};