Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 332x 74x 57x 53x 53x 53x 53x 26x 120x 26x 119x 119x 73x | import { createFileRoute } from "@tanstack/react-router";
import { DebtsExchangeAllScreen } from "~app/features/debts-exchange-all/debts-exchange-all-screen";
import { getTitle } from "~web/utils/i18n";
import { searchParamsWithDefaults } from "~web/utils/navigation";
import { getLoaderTrpcClient } from "~web/utils/trpc";
export const Route = createFileRoute("/_protected/debts/peer/$id/exchange/all")(
{
component: DebtsExchangeAllScreen,
...searchParamsWithDefaults("/_protected/debts/peer/$id/exchange/all"),
loaderDeps: ({ search: { from } }) => ({ from }),
loader: async (ctx) => {
await ctx.context.i18nContext.loadNamespaces("debts");
if (!import.meta.env.SSR) {
return;
}
const trpc = getLoaderTrpcClient(ctx.context);
const debts = await ctx.context.queryClient.fetchQuery(
trpc.debts.getAllPeer.queryOptions({ peerId: ctx.params.id }),
);
if (ctx.deps.from) {
const nonResolvedDebts = debts.items.filter(
(element) => element.sum !== 0,
);
await ctx.context.queryClient.fetchQuery(
trpc.currency.rates.queryOptions({
from: ctx.deps.from,
to: nonResolvedDebts
.map((debt) => debt.currencyCode)
.filter((code) => code !== ctx.deps.from),
}),
);
}
},
head: ({ match }) => ({
meta: [
{ title: getTitle(match.context.i18nContext, "exchangeAllDebts") },
],
}),
},
);
|