Welcome to mirror list, hosted at ThFree Co, Russian Federation.

load_branches.js « info « commit_box « projects « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8a0b2c30abe1b363b497d803b55905553c98a559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import axios from 'axios';
import { sanitize } from '~/lib/dompurify';
import { __ } from '~/locale';

export const loadBranches = (containerEl) => {
  if (!containerEl) {
    return;
  }

  const { commitPath } = containerEl.dataset;
  const branchesEl = containerEl.querySelector('.commit-info.branches');
  axios
    .get(commitPath)
    .then(({ data }) => {
      branchesEl.innerHTML = sanitize(data);
    })
    .catch(() => {
      branchesEl.textContent = __('Failed to load branches. Please try again.');
    });
};