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

index.js « openapi « blob « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a04da98ff776c0a01e10c61ab61f3ea0cd767d89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { SwaggerUIBundle } from 'swagger-ui-dist';
import createFlash from '~/flash';
import { __ } from '~/locale';

export default () => {
  const el = document.getElementById('js-openapi-viewer');

  Promise.all([import(/* webpackChunkName: 'openapi' */ 'swagger-ui-dist/swagger-ui.css')])
    .then(() => {
      SwaggerUIBundle({
        url: el.dataset.endpoint,
        dom_id: '#js-openapi-viewer',
        deepLinking: true,
      });
    })
    .catch((error) => {
      createFlash({
        message: __('Something went wrong while initializing the OpenAPI viewer'),
      });
      throw error;
    });
};