-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): Changed objects to classes (#306)
Co-authored-by: vr-varad <varadgupta21#gmail.com>
- Loading branch information
Showing
3 changed files
with
22 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
import { Logger } from '@/util/logger' | ||
|
||
const AuthController = { | ||
async checkApiKeyValidity(baseUrl: string, apiKey: string): Promise<void> { | ||
Logger.info('Checking API key validity...') | ||
const response = await fetch(`${baseUrl}/api/api-key/access/live-updates`, { | ||
headers: { | ||
'x-keyshade-token': apiKey | ||
class AuthController { | ||
static async checkApiKeyValidity(baseUrl: string, apiKey: string): Promise<void> { | ||
Logger.info('Checking API key validity...') | ||
const response = await fetch(`${baseUrl}/api/api-key/access/live-updates`, { | ||
headers: { | ||
'x-keyshade-token': apiKey | ||
} | ||
}) | ||
|
||
if (!response.ok) { | ||
throw new Error( | ||
'API key is not valid. Please check the key and try again.' | ||
) | ||
} | ||
|
||
Logger.info('API key is valid!') | ||
} | ||
}) | ||
|
||
if (!response.ok) { | ||
throw new Error( | ||
'API key is not valid. Please check the key and try again.' | ||
) | ||
} | ||
|
||
Logger.info('API key is valid!') | ||
} | ||
} | ||
|
||
|
||
export default AuthController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters