chore: get api key from coookie

This commit is contained in:
Sebastian Velez
2023-02-15 12:25:19 -05:00
parent ffd2a48b29
commit 00209ec96f
5 changed files with 35 additions and 4 deletions

View File

@@ -34,6 +34,13 @@ export const fetchUserData = async (
apiKey: config.apiKey,
});
apiKey = storage.apiKey as string;
if (!apiKey) {
apiKey = await WakaTimeCore.fetchApiKey();
if (apiKey) {
await browser.storage.sync.set({ apiKey });
}
}
dispatch(setApiKey(apiKey));
}