feat: open checkout with user language

This commit is contained in:
Zamitto 2024-11-08 22:40:30 -03:00
parent 34ec8467ec
commit 77e9de704d

View File

@ -1,10 +1,16 @@
import { shell } from "electron"; import { shell } from "electron";
import { registerEvent } from "../register-event"; import { registerEvent } from "../register-event";
import { userAuthRepository } from "@main/repository"; import {
userAuthRepository,
userPreferencesRepository,
} from "@main/repository";
import { HydraApi } from "@main/services"; import { HydraApi } from "@main/services";
const openCheckout = async (_event: Electron.IpcMainInvokeEvent) => { const openCheckout = async (_event: Electron.IpcMainInvokeEvent) => {
const userAuth = await userAuthRepository.findOne({ where: { id: 1 } }); const [userAuth, userPreferences] = await Promise.all([
userAuthRepository.findOne({ where: { id: 1 } }),
userPreferencesRepository.findOne({ where: { id: 1 } }),
]);
if (!userAuth) { if (!userAuth) {
return; return;
@ -16,6 +22,7 @@ const openCheckout = async (_event: Electron.IpcMainInvokeEvent) => {
const params = new URLSearchParams({ const params = new URLSearchParams({
token: paymentToken, token: paymentToken,
lng: userPreferences?.language || "en",
}); });
shell.openExternal( shell.openExternal(