feat: WEB-210 Updated lang type
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { env } from "process"
|
import { env } from "process"
|
||||||
|
|
||||||
|
import { Lang } from "@/constants/languages"
|
||||||
import * as api from "@/lib/api"
|
import * as api from "@/lib/api"
|
||||||
import {
|
import {
|
||||||
protectedProcedure,
|
protectedProcedure,
|
||||||
@@ -69,7 +70,7 @@ function fakingRequest<T>(payload: T): Promise<T> {
|
|||||||
const updateStaysBookingUrl = async (
|
const updateStaysBookingUrl = async (
|
||||||
data: Stay[],
|
data: Stay[],
|
||||||
token: string,
|
token: string,
|
||||||
lang: string
|
lang: Lang
|
||||||
) => {
|
) => {
|
||||||
// Tenporary API call needed till we have user name in ctx session data
|
// Tenporary API call needed till we have user name in ctx session data
|
||||||
const apiResponse = await api.get(api.endpoints.v1.profile, {
|
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 localeDomain = env.PUBLIC_URL
|
||||||
let fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
|
let fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
|
||||||
switch (lang) {
|
switch (lang) {
|
||||||
case "sv":
|
case Lang.sv:
|
||||||
localeDomain = localeDomain?.replace(".com", ".se")
|
localeDomain = localeDomain?.replace(".com", ".se")
|
||||||
fullBookingUrl = localeDomain + "/hotelreservation/din-bokning"
|
fullBookingUrl = localeDomain + "/hotelreservation/din-bokning"
|
||||||
break
|
break
|
||||||
case "no":
|
case Lang.no:
|
||||||
localeDomain = localeDomain?.replace(".com", ".no")
|
localeDomain = localeDomain?.replace(".com", ".no")
|
||||||
fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
|
fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
|
||||||
break
|
break
|
||||||
case "da":
|
case Lang.da:
|
||||||
localeDomain = localeDomain?.replace(".com", ".dk")
|
localeDomain = localeDomain?.replace(".com", ".dk")
|
||||||
fullBookingUrl = localeDomain + "/hotelreservation/min-booking"
|
fullBookingUrl = localeDomain + "/hotelreservation/min-booking"
|
||||||
break
|
break
|
||||||
case "fi":
|
case Lang.fi:
|
||||||
localeDomain = localeDomain?.replace(".com", ".fi")
|
localeDomain = localeDomain?.replace(".com", ".fi")
|
||||||
fullBookingUrl = localeDomain + "/varaa-hotelli/varauksesi"
|
fullBookingUrl = localeDomain + "/varaa-hotelli/varauksesi"
|
||||||
break
|
break
|
||||||
case "de":
|
case Lang.de:
|
||||||
localeDomain = localeDomain?.replace(".com", ".de")
|
localeDomain = localeDomain?.replace(".com", ".de")
|
||||||
fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
|
fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ export default function encryptValue(originalString: string) {
|
|||||||
let paddingSize =
|
let paddingSize =
|
||||||
bufferKey.length - (bufferString.length % bufferKey.length)
|
bufferKey.length - (bufferString.length % bufferKey.length)
|
||||||
let paddedStr = Buffer.concat([bufferString, Buffer.alloc(paddingSize, 0)])
|
let paddedStr = Buffer.concat([bufferString, Buffer.alloc(paddingSize, 0)])
|
||||||
result = cipher.update(paddedStr).toString("base64").replace(/\+/g, "-")
|
result = cipher.update(paddedStr).toString("base64")
|
||||||
cipher.final()
|
result = (result + cipher.final("base64")).replace(/\+/g, "-")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user