diff options
Diffstat (limited to 'app/assets/javascripts/lib/swagger.js')
-rw-r--r-- | app/assets/javascripts/lib/swagger.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/swagger.js b/app/assets/javascripts/lib/swagger.js index ed646176604..fcdab18c623 100644 --- a/app/assets/javascripts/lib/swagger.js +++ b/app/assets/javascripts/lib/swagger.js @@ -1,6 +1,13 @@ import { SwaggerUIBundle } from 'swagger-ui-dist'; import { safeLoad } from 'js-yaml'; import { isObject } from '~/lib/utils/type_utility'; +import { getParameterByName } from '~/lib/utils/url_utility'; +import { resetServiceWorkersPublicPath } from '~/lib/utils/webpack'; + +const resetWebpackPublicPath = () => { + window.gon = { relative_url_root: getParameterByName('relativeRootPath') }; + resetServiceWorkersPublicPath(); +}; const renderSwaggerUI = (value) => { /* SwaggerUIBundle accepts openapi definition @@ -12,6 +19,8 @@ const renderSwaggerUI = (value) => { spec = safeLoad(spec, { json: true }); } + resetWebpackPublicPath(); + Promise.all([import(/* webpackChunkName: 'openapi' */ 'swagger-ui-dist/swagger-ui.css')]) .then(() => { SwaggerUIBundle({ |