2019-07-07 11:18:12 +05:30
|
|
|
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
|
|
|
|
|
|
|
|
export const clearDraft = autosaveKey => {
|
|
|
|
try {
|
|
|
|
window.localStorage.removeItem(`autosave/${autosaveKey}`);
|
|
|
|
} catch (e) {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getDraft = autosaveKey => {
|
|
|
|
try {
|
|
|
|
return window.localStorage.getItem(`autosave/${autosaveKey}`);
|
|
|
|
} catch (e) {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(e);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const updateDraft = (autosaveKey, text) => {
|
|
|
|
try {
|
|
|
|
window.localStorage.setItem(`autosave/${autosaveKey}`, text);
|
|
|
|
} catch (e) {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getDiscussionReplyKey = (noteableType, discussionId) =>
|
2020-04-22 19:07:51 +05:30
|
|
|
/* eslint-disable-next-line @gitlab/require-i18n-strings */
|
2019-07-07 11:18:12 +05:30
|
|
|
['Note', capitalizeFirstCharacter(noteableType), discussionId, 'Reply'].join('/');
|