Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Invalidate cache after deleting API key
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed May 13, 2019
1 parent 2631c74 commit bfd3691
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/crud/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ export const updateApiKey = async (apiKey: string, data: KeyValue) => {
* Delete an API key
*/
export const deleteApiKey = async (apiKey: string) => {
const apiKeyDetails = await getApiKey(apiKey);
deleteItemFromCache(CacheCategories.API_KEY, apiKey);
deleteItemFromCache(CacheCategories.API_KEYS, apiKeyDetails.userId);
return await query("DELETE FROM `api-keys` WHERE apiKey = ? LIMIT 1", [
apiKey
]);
Expand Down

0 comments on commit bfd3691

Please sign in to comment.