2021-09-30 23:02:18 +05:30
|
|
|
import createFlash from '~/flash';
|
2018-03-17 18:26:18 +05:30
|
|
|
import axios from '../lib/utils/axios_utils';
|
|
|
|
import { __ } from '../locale';
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
export const getSelector = (highlightId) => `.js-feature-highlight[data-highlight=${highlightId}]`;
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
export function dismiss(endpoint, highlightId) {
|
|
|
|
return axios
|
|
|
|
.post(endpoint, {
|
2018-12-13 13:39:08 +05:30
|
|
|
feature_name: highlightId,
|
|
|
|
})
|
|
|
|
.catch(() =>
|
2021-09-30 23:02:18 +05:30
|
|
|
createFlash({
|
|
|
|
message: __(
|
2018-12-13 13:39:08 +05:30
|
|
|
'An error occurred while dismissing the feature highlight. Refresh the page and try dismissing again.',
|
|
|
|
),
|
2021-09-30 23:02:18 +05:30
|
|
|
}),
|
2018-12-13 13:39:08 +05:30
|
|
|
);
|
2018-03-17 18:26:18 +05:30
|
|
|
}
|