2021-06-18 00:10:29 +00:00
|
|
|
import createFlash from '~/flash';
|
2021-02-14 18:09:20 +00:00
|
|
|
import axios from '../lib/utils/axios_utils';
|
|
|
|
import { __ } from '../locale';
|
2018-01-11 04:16:27 +00:00
|
|
|
|
2020-12-23 21:10:24 +00:00
|
|
|
export const getSelector = (highlightId) => `.js-feature-highlight[data-highlight=${highlightId}]`;
|
2018-01-11 04:16:27 +00:00
|
|
|
|
2021-02-15 06:09:22 +00:00
|
|
|
export function dismiss(endpoint, highlightId) {
|
|
|
|
return axios
|
|
|
|
.post(endpoint, {
|
2018-10-10 06:18:49 +00:00
|
|
|
feature_name: highlightId,
|
|
|
|
})
|
|
|
|
.catch(() =>
|
2021-06-18 00:10:29 +00:00
|
|
|
createFlash({
|
|
|
|
message: __(
|
2018-10-10 06:18:49 +00:00
|
|
|
'An error occurred while dismissing the feature highlight. Refresh the page and try dismissing again.',
|
|
|
|
),
|
2021-06-18 00:10:29 +00:00
|
|
|
}),
|
2018-10-10 06:18:49 +00:00
|
|
|
);
|
2018-01-11 04:16:27 +00:00
|
|
|
}
|