All files / apps/web/src/pages/_protected/debts transfer.tsx

100% Statements 8/8
100% Branches 2/2
100% Functions 4/4
100% Lines 8/8

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              332x     61x   38x 38x 38x   76x 65x             59x        
import { createFileRoute } from "@tanstack/react-router";
 
import { DebtsTransferScreen } from "~app/features/debts-transfer/debts-transfer-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/transfer")({
	component: DebtsTransferScreen,
	...searchParamsWithDefaults("/_protected/debts/transfer"),
	loaderDeps: ({ search: { to, from } }) => ({ to, from }),
	loader: async (ctx) => {
		await ctx.context.i18nContext.loadNamespaces("debts");
		const trpc = getLoaderTrpcClient(ctx.context);
		await Promise.all(
			[ctx.deps.to, ctx.deps.from].map(async (peerId) => {
				if (peerId) {
					await ctx.context.queryClient.fetchQuery(
						trpc.peers.get.queryOptions({ id: peerId }),
					);
				}
			}),
		);
	},
	head: ({ match }) => ({
		meta: [{ title: getTitle(match.context.i18nContext, "transferDebts") }],
	}),
});