Add helper util for authenticating the public API SDK in component plugins

This commit is contained in:
Andrew Kingston 2022-09-21 09:49:33 +01:00
parent b9bee3aede
commit 5f3acec8e6
2 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import { getAction } from "utils/getAction"
import Provider from "components/context/Provider.svelte" import Provider from "components/context/Provider.svelte"
import { ActionTypes } from "./constants" import { ActionTypes } from "./constants"
import { fetchDatasourceSchema } from "./utils/schema.js" import { fetchDatasourceSchema } from "./utils/schema.js"
import { getAPIKey } from "./utils/api.js"
export default { export default {
API, API,
@ -36,4 +37,5 @@ export default {
fetchDatasourceSchema, fetchDatasourceSchema,
Provider, Provider,
ActionTypes, ActionTypes,
getAPIKey,
} }

View File

@ -0,0 +1,6 @@
import { API } from "api"
export const getAPIKey = async () => {
const { apiKey } = await API.fetchDeveloperInfo()
return apiKey
}