summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/feature_highlight/feature_highlight_helper.js
blob: 747f368b671431d745e82ab6f154d46265b8c1e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import createFlash from '~/flash';
import axios from '../lib/utils/axios_utils';
import { __ } from '../locale';

export const getSelector = (highlightId) => `.js-feature-highlight[data-highlight=${highlightId}]`;

export function dismiss(endpoint, highlightId) {
  return axios
    .post(endpoint, {
      feature_name: highlightId,
    })
    .catch(() =>
      createFlash({
        message: __(
          'An error occurred while dismissing the feature highlight. Refresh the page and try dismissing again.',
        ),
      }),
    );
}