Allow to pass lazy GraphQL endpoint url to graphiql plugin

Signed-off-by: Dmitriy Lazarev <w@kich.dev>
This commit is contained in:
Dmitriy Lazarev
2023-03-22 16:23:36 +04:00
parent 0e309814a9
commit 8b9e8ece40
3 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-graphiql': patch
---
Allow to pass lazy GraphQL endpoint URL
+1 -1
View File
@@ -16,7 +16,7 @@ import { RouteRef } from '@backstage/core-plugin-api';
export type EndpointConfig = {
id: string;
title: string;
url: string;
url: string | Promise<string>;
method?: 'POST';
headers?: {
[name in string]: string;
@@ -26,7 +26,7 @@ export type EndpointConfig = {
id: string;
title: string;
// Endpoint URL
url: string;
url: string | Promise<string>;
// only supports POST right now
method?: 'POST';
// Defaults to setting Content-Type to application/json
@@ -66,7 +66,7 @@ export class GraphQLEndpoints implements GraphQLBrowseApi {
...config.headers,
...options.headers,
};
const res = await fetch(url, {
const res = await fetch(await url, {
method,
headers,
body,