debian-mirror-gitlab/app/assets/javascripts/diffs/utils/preferences.js

14 lines
349 B
JavaScript
Raw Normal View History

2021-02-22 17:27:13 +05:30
import Cookies from 'js-cookie';
import { DIFF_FILE_BY_FILE_COOKIE_NAME, DIFF_VIEW_FILE_BY_FILE } from '../constants';
export function fileByFile(pref = false) {
const cookie = Cookies.get(DIFF_FILE_BY_FILE_COOKIE_NAME);
// use the cookie first, if it exists
if (cookie) {
2021-04-17 20:07:23 +05:30
return cookie === DIFF_VIEW_FILE_BY_FILE;
2021-02-22 17:27:13 +05:30
}
2021-04-17 20:07:23 +05:30
return pref;
2021-02-22 17:27:13 +05:30
}