Skip to content

Commit 5251a85

Browse files
committed
only return apikey when it has a value
1 parent 1384fe4 commit 5251a85

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/app/src/utils/auth.util.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
// function to get api key from local storage
22
const LOCAL_API_KEY = 'local_api_key'
33
function getLocalApiKey() {
4-
return localStorage.getItem(LOCAL_API_KEY)
4+
const apiKey = localStorage.getItem(LOCAL_API_KEY)
5+
if (apiKey === 'undefined') {
6+
return null
7+
}
8+
return apiKey
59
}
610

711
function setLocalApiKey(apiKey: string) {
12+
if (apiKey === 'undefined') return
813
localStorage.setItem(LOCAL_API_KEY, apiKey)
914
}
1015

0 commit comments

Comments
 (0)