mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adding initial leveldb configuration
This commit is contained in:
parent
d4be5b8c66
commit
2c5fb8a037
18 changed files with 202 additions and 196 deletions
|
@ -1,17 +1,21 @@
|
|||
import { shell } from "electron";
|
||||
import { registerEvent } from "../register-event";
|
||||
import { userAuthRepository } from "@main/repository";
|
||||
import { HydraApi } from "@main/services";
|
||||
import { Crypto, HydraApi } from "@main/services";
|
||||
import { db } from "@main/level";
|
||||
import type { Auth } from "@types";
|
||||
import { levelKeys } from "@main/level/sublevels/keys";
|
||||
|
||||
const openCheckout = async (_event: Electron.IpcMainInvokeEvent) => {
|
||||
const userAuth = await userAuthRepository.findOne({ where: { id: 1 } });
|
||||
const auth = await db.get<string, Auth>(levelKeys.auth, {
|
||||
valueEncoding: "json",
|
||||
});
|
||||
|
||||
if (!userAuth) {
|
||||
if (!auth) {
|
||||
return;
|
||||
}
|
||||
|
||||
const paymentToken = await HydraApi.post("/auth/payment", {
|
||||
refreshToken: userAuth.refreshToken,
|
||||
refreshToken: Crypto.decrypt(auth.refreshToken),
|
||||
}).then((response) => response.accessToken);
|
||||
|
||||
const params = new URLSearchParams({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue