Skip to content

Commit

Permalink
refactor: correct renaming of the queryOptions for digital signature …
Browse files Browse the repository at this point in the history
…queries (#407)

refactor: correct renaming of the queryOptions for digital signature queries
  • Loading branch information
SeanCassiere authored Aug 4, 2024
1 parent 6b0a2cb commit ce113d8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/lib/query/digitalSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { Auth, Enabled } from "./helpers";

const SEGMENT = "digital_signature";

export function fetchDigitalSignatureDriversList(
export function getDigSigDriversListOptions(
options: {
agreementId?: string;
reservationId?: string;
Expand All @@ -33,10 +33,11 @@ export function fetchDigitalSignatureDriversList(
})
.then((res) => ({ ...res, headers: null })),
enabled: isEnabled(options) && enabled,
staleTime: 1000 * 60 * 1, // 1 minute
});
}

export function fetchAgreementCustomerDigitalSignatureUrl(
export function getAgreementCustomerDigSigUrlOptions(
options: {
agreementId: string;
driverId: string | null;
Expand Down Expand Up @@ -68,7 +69,7 @@ export function fetchAgreementCustomerDigitalSignatureUrl(
});
}

export function fetchAgreementAdditionalDriverDigitalSignatureUrl(
export function getAgreementAdditionalDriverDigSigUrlOptions(
options: {
agreementId: string;
additionalDriverId: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { useDatePreference } from "@/lib/hooks/useDatePreferences";
import type { AgreementDataParsed } from "@/lib/schemas/agreement";
import type { DigitalSignatureDriver } from "@/lib/schemas/digital-signature/driverList";
import {
fetchAgreementAdditionalDriverDigitalSignatureUrl,
fetchAgreementCustomerDigitalSignatureUrl,
getAgreementAdditionalDriverDigSigUrlOptions,
getAgreementCustomerDigSigUrlOptions,
} from "@/lib/query/digitalSignature";
import type { Auth } from "@/lib/query/helpers";

Expand Down Expand Up @@ -102,7 +102,7 @@ export default function SummarySignatureCard(

function SignatureImage(props: BaseDriverProps) {
const signatureQuery = useSuspenseQuery(
fetchAgreementCustomerDigitalSignatureUrl({
getAgreementCustomerDigSigUrlOptions({
agreementId: props.agreementId,
driverId: props.driver.driverId.toString(),
isCheckin: props.stage === "checkin",
Expand Down Expand Up @@ -239,7 +239,7 @@ function Driver(

function AdditionalDriverSignaturePopover(props: BaseDriverProps) {
const signatureQuery = useSuspenseQuery(
fetchAgreementAdditionalDriverDigitalSignatureUrl({
getAgreementAdditionalDriverDigSigUrlOptions({
agreementId: props.agreementId,
additionalDriverId: props.driver.driverId.toString(),
isCheckin: props.stage === "checkin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { useFeature } from "@/lib/hooks/useFeature";
import { useLocalStorage } from "@/lib/hooks/useLocalStorage";

import { fetchDigitalSignatureDriversList } from "@/lib/query/digitalSignature";
import { getDigSigDriversListOptions } from "@/lib/query/digitalSignature";

import CustomerInformation from "@/routes/_auth/-modules/information-block/customer-information";
import RentalInformation from "@/routes/_auth/-modules/information-block/rental-information";
Expand All @@ -28,7 +28,7 @@ export const Route = createFileRoute(
beforeLoad: ({ context, params }) => {
const { authParams } = context;
return {
digitalSignatureDriversOptions: fetchDigitalSignatureDriversList({
digitalSignatureDriversOptions: getDigSigDriversListOptions({
auth: authParams,
agreementId: params.agreementId,
}),
Expand Down

0 comments on commit ce113d8

Please sign in to comment.