feat: WEB-210 Updated lang type

This commit is contained in:
Hrishikesh Vaipurkar
2024-07-03 09:51:53 +02:00
parent 1f53b29a69
commit 3f69eda17f
2 changed files with 10 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
import { env } from "process"
import { Lang } from "@/constants/languages"
import * as api from "@/lib/api"
import {
protectedProcedure,
@@ -69,7 +70,7 @@ function fakingRequest<T>(payload: T): Promise<T> {
const updateStaysBookingUrl = async (
data: Stay[],
token: string,
lang: string
lang: Lang
) => {
// Tenporary API call needed till we have user name in ctx session data
const apiResponse = await api.get(api.endpoints.v1.profile, {
@@ -79,27 +80,27 @@ const updateStaysBookingUrl = async (
},
})
// Temporary domain and lang support for current web
// Temporary Url, domain and lang support for current web
let localeDomain = env.PUBLIC_URL
let fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
switch (lang) {
case "sv":
case Lang.sv:
localeDomain = localeDomain?.replace(".com", ".se")
fullBookingUrl = localeDomain + "/hotelreservation/din-bokning"
break
case "no":
case Lang.no:
localeDomain = localeDomain?.replace(".com", ".no")
fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
break
case "da":
case Lang.da:
localeDomain = localeDomain?.replace(".com", ".dk")
fullBookingUrl = localeDomain + "/hotelreservation/min-booking"
break
case "fi":
case Lang.fi:
localeDomain = localeDomain?.replace(".com", ".fi")
fullBookingUrl = localeDomain + "/varaa-hotelli/varauksesi"
break
case "de":
case Lang.de:
localeDomain = localeDomain?.replace(".com", ".de")
fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
break

View File

@@ -13,8 +13,8 @@ export default function encryptValue(originalString: string) {
let paddingSize =
bufferKey.length - (bufferString.length % bufferKey.length)
let paddedStr = Buffer.concat([bufferString, Buffer.alloc(paddingSize, 0)])
result = cipher.update(paddedStr).toString("base64").replace(/\+/g, "-")
cipher.final()
result = cipher.update(paddedStr).toString("base64")
result = (result + cipher.final("base64")).replace(/\+/g, "-")
} catch (e) {
console.log(e)
}