summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/gitlab_version_check/utils.js
blob: d2f4349483c08269a6346cef6616fbb8590de7b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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));
};