fix(SW-2614): send language to API
We were missing the language param on some endpoints. We are still missing it on some, but I left those without when we don't need it, e.g. when only caring about the IDs in the response.
This commit is contained in:
committed by
Michael Zetterberg
parent
35a2ae9dcc
commit
e0fe5ff0d5
@@ -6,6 +6,7 @@ import {
|
||||
router,
|
||||
safeProtectedProcedure,
|
||||
} from "@/server/trpc"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { isValidSession } from "@/utils/session"
|
||||
import { getFriendsMembership, getMembershipCards } from "@/utils/user"
|
||||
@@ -154,7 +155,8 @@ export const userQueryRouter = router({
|
||||
|
||||
const previousStaysData = await getPreviousStays(
|
||||
ctx.session.token.access_token,
|
||||
1
|
||||
1,
|
||||
ctx.lang
|
||||
)
|
||||
if (!previousStaysData) {
|
||||
metricsUserTrackingInfo.success({
|
||||
@@ -199,6 +201,7 @@ export const userQueryRouter = router({
|
||||
const data = await getPreviousStays(
|
||||
ctx.session.token.access_token,
|
||||
limit,
|
||||
language,
|
||||
cursor
|
||||
)
|
||||
|
||||
@@ -231,6 +234,7 @@ export const userQueryRouter = router({
|
||||
const data = await getUpcomingStays(
|
||||
ctx.session.token.access_token,
|
||||
limit,
|
||||
language,
|
||||
cursor
|
||||
)
|
||||
|
||||
@@ -258,7 +262,7 @@ export const userQueryRouter = router({
|
||||
friendTransactions: languageProtectedProcedure
|
||||
.input(friendTransactionsInput)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { limit, page } = input
|
||||
const { limit, page, lang } = input
|
||||
|
||||
const friendTransactionsCounter = createCounter(
|
||||
"trpc.user.transactions",
|
||||
@@ -268,16 +272,22 @@ export const userQueryRouter = router({
|
||||
const metricsFriendTransactions = friendTransactionsCounter.init({
|
||||
limit,
|
||||
page,
|
||||
lang,
|
||||
})
|
||||
|
||||
metricsFriendTransactions.start()
|
||||
|
||||
const language = lang ?? ctx.lang
|
||||
|
||||
const apiResponse = await api.get(
|
||||
api.endpoints.v1.Profile.Transaction.friendTransactions,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
},
|
||||
},
|
||||
{
|
||||
language: toApiLang(language),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user