Merged in hotfix/mystays-show-more (pull request #1698)
hotfix: my stays - pass language to trpc * hotfix: my stays - pass language to trpc Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -4,6 +4,7 @@ import { trpc } from "@/lib/trpc/client"
|
||||
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
import Grids from "@/components/TempDesignSystem/Grids"
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
import ListContainer from "../ListContainer"
|
||||
import ShowMoreButton from "../ShowMoreButton"
|
||||
@@ -17,10 +18,12 @@ import type {
|
||||
export default function ClientPreviousStays({
|
||||
initialPreviousStays,
|
||||
}: PreviousStaysClientProps) {
|
||||
const lang = useLang()
|
||||
const { data, isFetching, fetchNextPage, hasNextPage, isLoading } =
|
||||
trpc.user.stays.previous.useInfiniteQuery(
|
||||
{
|
||||
limit: 6,
|
||||
lang,
|
||||
},
|
||||
{
|
||||
getNextPageParam: (lastPage) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { trpc } from "@/lib/trpc/client"
|
||||
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
import Grids from "@/components/TempDesignSystem/Grids"
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
import ListContainer from "../ListContainer"
|
||||
import ShowMoreButton from "../ShowMoreButton"
|
||||
@@ -17,10 +18,12 @@ import type {
|
||||
export default function ClientUpcomingStays({
|
||||
initialUpcomingStays,
|
||||
}: UpcomingStaysClientProps) {
|
||||
const lang = useLang()
|
||||
const { data, isFetching, fetchNextPage, hasNextPage, isLoading } =
|
||||
trpc.user.stays.upcoming.useInfiniteQuery(
|
||||
{
|
||||
limit: 6,
|
||||
lang,
|
||||
},
|
||||
{
|
||||
getNextPageParam: (lastPage) => {
|
||||
|
||||
@@ -16,6 +16,7 @@ export const staysInput = z
|
||||
.min(0)
|
||||
.default(6)
|
||||
.transform((num) => String(num)),
|
||||
lang: z.nativeEnum(Lang).optional(),
|
||||
})
|
||||
.default({})
|
||||
|
||||
|
||||
@@ -452,7 +452,8 @@ export const userQueryRouter = router({
|
||||
previous: protectedProcedure
|
||||
.input(staysInput)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { limit, cursor } = input
|
||||
const { limit, cursor, lang } = input
|
||||
const language = lang || ctx.lang
|
||||
const params: Record<string, string> = { limit }
|
||||
if (cursor) {
|
||||
params.offset = cursor
|
||||
@@ -533,7 +534,7 @@ export const userQueryRouter = router({
|
||||
const updatedData = await updateStaysBookingUrl(
|
||||
verifiedData.data.data,
|
||||
ctx.session.token.access_token,
|
||||
ctx.lang
|
||||
language
|
||||
)
|
||||
|
||||
return {
|
||||
@@ -545,8 +546,8 @@ export const userQueryRouter = router({
|
||||
upcoming: protectedProcedure
|
||||
.input(staysInput)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { limit, cursor } = input
|
||||
|
||||
const { limit, cursor, lang } = input
|
||||
const language = lang || ctx.lang
|
||||
const params: Record<string, string> = { limit }
|
||||
if (cursor) {
|
||||
params.offset = cursor
|
||||
@@ -626,7 +627,7 @@ export const userQueryRouter = router({
|
||||
const updatedData = await updateStaysBookingUrl(
|
||||
verifiedData.data.data,
|
||||
ctx.session.token.access_token,
|
||||
ctx.lang
|
||||
language
|
||||
)
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user