Skip to content

Commit

Permalink
adding env files to mask secrets (#20)
Browse files Browse the repository at this point in the history
* adding env files to mask secrets

* lint fix

---------

Co-authored-by: Visakh Vijayan <visakh.vijayan@jalantechnologies.com>
  • Loading branch information
visakhvjn and vjnvisakh-jtc authored Feb 29, 2024
1 parent ac67fe5 commit 9d654a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
7 changes: 5 additions & 2 deletions src/components/main/main.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const Main = () => {
const [isSpeaking, setIsSpeaking] = useState(false);

const promotionText = `\n\nDiscover more such quotes at - ${window.location.origin}`;
const NINJA_API_KEY = process.env.REACT_APP_NINJA_API_KEY as string;
const NINJA_URL = process.env.REACT_APP_NINJA_URL as string;

const handleSpeakClick = (text: string) => {

Expand All @@ -44,11 +46,11 @@ export const Main = () => {
setIsLoading(true);

const response = await fetch(
'https://api.api-ninjas.com/v1/quotes',
NINJA_URL,
{
method: 'GET',
headers: {
'X-Api-Key': 'WZl9PgOgZcA+7LYsJTyIkg==SxDi8ufcTDJRpl3i'
'X-Api-Key': NINJA_API_KEY
}
}
);
Expand All @@ -67,6 +69,7 @@ export const Main = () => {
firstLoad = false;
fetchNewQuote();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down

0 comments on commit 9d654a6

Please sign in to comment.