Skip to content

Commit

Permalink
fix: keep api key secret
Browse files Browse the repository at this point in the history
  • Loading branch information
Code-Victor committed May 15, 2023
1 parent e226661 commit 5f620a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_UNSPLASH_KEY: string;
// more env variables...
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}
2 changes: 1 addition & 1 deletion src/store/slices/imageSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface ImageSlice {
}

const unsplash = createApi({
accessKey: "KxpNPWHtw7i2ylXHm1MRNLLReT1rabDWHSfU61zpUfg",
accessKey: import.meta.env.VITE_UNSPLASH_KEY,
//...other fetch options
});

Expand Down

0 comments on commit 5f620a9

Please sign in to comment.