From 17a65d285d13740b15cd3903ffb913fd65383b02 Mon Sep 17 00:00:00 2001 From: Matt Mulligan Date: Thu, 23 Jun 2022 10:35:29 -0400 Subject: [PATCH] Removed front end changes Signed-off-by: Matt Mulligan --- .changeset/friendly-sheep-flash.md | 1 - plugins/stack-overflow/config.d.ts | 2 +- .../src/home/StackOverflowQuestions/Content.tsx | 12 +----------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.changeset/friendly-sheep-flash.md b/.changeset/friendly-sheep-flash.md index 83df13b290..58ae309bf1 100644 --- a/.changeset/friendly-sheep-flash.md +++ b/.changeset/friendly-sheep-flash.md @@ -1,5 +1,4 @@ --- -'@backstage/plugin-stack-overflow': patch '@backstage/plugin-stack-overflow-backend': patch --- diff --git a/plugins/stack-overflow/config.d.ts b/plugins/stack-overflow/config.d.ts index 181f196312..cf50241ec9 100644 --- a/plugins/stack-overflow/config.d.ts +++ b/plugins/stack-overflow/config.d.ts @@ -27,7 +27,7 @@ export interface Config { /** * The api key to authenticate to Stack Overflow API - * @visibility frontend + * @visibility secret */ apiKey?: string; }; diff --git a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx index 8b954f5cf4..6d2ef9856a 100644 --- a/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx +++ b/plugins/stack-overflow/src/home/StackOverflowQuestions/Content.tsx @@ -42,7 +42,6 @@ import { export const Content = (props: StackOverflowQuestionsContentProps) => { const { requestParams } = props; const configApi = useApi(configApiRef); - const apiKey = configApi.getOptionalString('stackoverflow.apiKey'); const baseUrl = configApi.getOptionalString('stackoverflow.baseUrl') || 'https://api.stackexchange.com/2.2'; @@ -50,20 +49,11 @@ export const Content = (props: StackOverflowQuestionsContentProps) => { const { value, loading, error } = useAsync(async (): Promise< StackOverflowQuestion[] > => { - try { - if (Object.keys(requestParams).indexOf('key') >= 0) { - delete requestParams.key; - } - } catch (e) { - // console.log("Failed to remove key from params"); - } - const params = qs.stringify(requestParams, { arrayFormat: 'comma', addQueryPrefix: true, }); - const apiKeyParam = apiKey ? `${params ? '&' : '?'}key=${apiKey}` : ''; - const response = await fetch(`${baseUrl}/questions${params}${apiKeyParam}`); + const response = await fetch(`${baseUrl}/questions${params}`); const data = await response.json(); return data.items; }, []);