Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Import unsplash key from env and git ignore env
Browse files Browse the repository at this point in the history
  • Loading branch information
qaiswardag committed Jul 25, 2023
1 parent 42f4373 commit d521d94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
.env

# Editor directories and files
.vscode/*
Expand Down
10 changes: 3 additions & 7 deletions src/store/modules/unsplash.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,15 @@ export default {
orientationType = `&orientation=${payload.orientation}`;
}

const unsplashKey = import.meta.env.VITE_UNSPLASH_KEY;

handleGetImages(
`https://api.unsplash.com/search/photos?page=${payload.currentPage}&per_page=24&query=${payload.searchTerm}${orientationType}`,
{
//TODO: the api key should not be available in frontend.
headers: {
'Accept-Version': 'v1',
Authorization:
'Client-ID 5m9Y7Ewvxu686LvPcfccdUKxIEJNWhhcnI2IkO95-ao',
Authorization: unsplashKey,
},
},
{
additionalCallTime: 0,
abortTimeoutTime: 12000,
}
);

Expand Down

0 comments on commit d521d94

Please sign in to comment.