fetch spec from url provided in query parameter

This commit is contained in:
Anna Bodnia
2017-03-19 13:28:10 +02:00
parent 5c77857b2d
commit 26d5305404
6 changed files with 30 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
import YAML from "js-yaml"
import { parseSeach } from "core/utils"
import yamlConfig from "../../../swagger-config.yaml"
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
@@ -16,22 +17,6 @@ const parseYamlConfig = (yaml, system) => {
}
}
const parseSeach = () => {
let map = {}
let search = window.location.search
if ( search != "" ) {
let params = search.substr(1).split("&");
for (let i in params) {
i = params[i].split("=");
map[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
}
}
return map;
}
export default function configPlugin (toolbox) {
let { fn } = toolbox