debian-mirror-gitlab/app/assets/javascripts/search_autocomplete_utils.js

20 lines
471 B
JavaScript
Raw Normal View History

2021-09-30 23:02:18 +05:30
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;
};