debian-mirror-gitlab/app/assets/javascripts/gitlab_version_check/utils.js
2023-03-05 14:24:40 +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));
};