debian-mirror-gitlab/app/assets/javascripts/gitlab_version_check/utils.js
2023-03-04 22:38:38 +05:30

18 lines
539 B
JavaScript

import { setCookie, getCookie, parseBoolean } from '~/lib/utils/common_utils';
import { COOKIE_EXPIRATION, COOKIE_SUFFIX } from './constants';
const buildKey = (currentVersion) => {
return `${currentVersion}${COOKIE_SUFFIX}`;
};
export const setHideAlertModalCookie = (currentVersion) => {
const key = buildKey(currentVersion);
setCookie(key, true, { expires: COOKIE_EXPIRATION });
};
export const getHideAlertModalCookie = (currentVersion) => {
const key = buildKey(currentVersion);
return parseBoolean(getCookie(key));
};