Skip to content

Commit 911bbff

Browse files
committed
fix(StyleGuide): remove deprecated public API key fetch, hardcode api key
1 parent a6b4ad1 commit 911bbff

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

.lintstagedrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
"(src|__mocks__)/**/*.js": [
33
"eslint --fix",
44
"prettier --write",
5-
"yarn test --bail --findRelatedTests",
5+
"yarn test --bail --findRelatedTests --passWithNoTests",
66
],
77
"package.json": ["fixpack"],
88
"src/**/*.{css,scss}": ["stylelint --fix"],

src/styleguidist/StyleGuide.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,32 +96,19 @@ const styles = ({ mq }) => {
9696
};
9797
};
9898

99+
window.apiKey = "5cc87b12d7c5370001c1d6554840ecb89d2743d2b0aad0588b8ba7eb";
100+
99101
export function StyleGuideRenderer({
100102
children,
101103
classes,
102104
hasSidebar,
103105
toc,
104106
version = null,
105107
}) {
106-
const [apiKey, setApiKey] = useState();
107108
const [dropdownOpen, toggleDropdown] = useState(false);
108109
const [expanded, expandSection] = useState();
109110
const [selected, setSelected] = useState("Components");
110111
const [node, setNode] = useState();
111-
useEffect(() => {
112-
fetch("https://backend.developer.geops.io/publickey")
113-
.then((response) => {
114-
return response.json();
115-
})
116-
.then((data) => {
117-
setApiKey(data.key);
118-
})
119-
.catch(() => {
120-
setApiKey("error");
121-
// eslint-disable-next-line no-console
122-
console.error("Request to get the apiKey failed");
123-
});
124-
}, []);
125112

126113
useEffect(() => {
127114
if (!node) return;
@@ -131,13 +118,6 @@ export function StyleGuideRenderer({
131118
}
132119
}, [node]);
133120

134-
if (!apiKey) {
135-
return null;
136-
}
137-
138-
// Makes apiKey accessible for all components.
139-
window.apiKey = apiKey;
140-
141121
return (
142122
<ThemeProvider theme={geopsTheme}>
143123
<div className={classes.root}>

0 commit comments

Comments
 (0)