mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-05-04 23:06:52 +00:00
Lazily request docs (so we don't request them before we've auth-ed)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Swagger from 'swagger-parser';
|
||||
import apis from './api';
|
||||
|
||||
const docsPromise = getDocs(); // Don't wait here. Just kick off the request
|
||||
let docsPromise;
|
||||
|
||||
async function getDocs() {
|
||||
const docs = await apis.swagger();
|
||||
@@ -9,6 +9,10 @@ async function getDocs() {
|
||||
}
|
||||
|
||||
export default async function getDocDefinitions(apiVersion, kind) {
|
||||
if (!docsPromise) {
|
||||
docsPromise = getDocs(); // Don't wait here. Just kick off the request
|
||||
}
|
||||
|
||||
const {definitions} = await docsPromise;
|
||||
|
||||
let [group, version] = apiVersion.split('/');
|
||||
|
||||
Reference in New Issue
Block a user