trying with the store and such

This commit is contained in:
talksik
2022-03-17 20:13:49 -04:00
parent 453121c987
commit 34fe8e0c29
21 changed files with 478 additions and 35758 deletions
+5 -3
View File
@@ -1,8 +1,9 @@
import store, { STORE_ITEMS } from "./store";
import Channels from "./constants";
import ElectronGoogleOAuth2 from "@getstation/electron-google-oauth2";
import { browserWindow } from "../index";
import { ipcMain } from "electron";
import store from "./store";
const myApiOauth = new ElectronGoogleOAuth2(
"423533244953-banligobgbof8hg89i6cr1l7u0p7c2pk.apps.googleusercontent.com",
@@ -14,7 +15,7 @@ const myApiOauth = new ElectronGoogleOAuth2(
export async function handleLogin() {
// read saved refresh token if any
// todo: fix this...should be working
const refreshToken = await store.get("tokens");
const authTokens = await store.get(STORE_ITEMS.AUTH_TOKENS);
// todo: remove this when I have way of getting access token from a refresh token
// if (refreshToken) {
@@ -35,7 +36,8 @@ export async function handleLogin() {
// }
const tokens = await myApiOauth.openAuthWindowAndGetTokens();
store.set("tokens", tokens);
store.set(STORE_ITEMS.AUTH_TOKENS, tokens);
browserWindow.webContents.send(Channels.AUTH_TOKENS, tokens);
}