Removed front end changes

Signed-off-by: Matt Mulligan <mmulligan03@gmail.com>
This commit is contained in:
Matt Mulligan
2022-06-23 10:35:29 -04:00
parent daabe780e0
commit 17a65d285d
3 changed files with 2 additions and 13 deletions
-1
View File
@@ -1,5 +1,4 @@
---
'@backstage/plugin-stack-overflow': patch
'@backstage/plugin-stack-overflow-backend': patch
---
+1 -1
View File
@@ -27,7 +27,7 @@ export interface Config {
/**
* The api key to authenticate to Stack Overflow API
* @visibility frontend
* @visibility secret
*/
apiKey?: string;
};
@@ -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;
}, []);