Skip to content

Commit

Permalink
misc: redirect to CN details after creation (#1525)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansmonjol authored May 31, 2024
1 parent 09eb437 commit 92f043e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/hooks/useCreateCreditNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
composeGroupedByDisplayName,
composeMultipleValuesWithSepator,
} from '~/core/formats/formatInvoiceItemsMap'
import { CUSTOMER_INVOICE_DETAILS_ROUTE, ERROR_404_ROUTE } from '~/core/router'
import { CUSTOMER_INVOICE_CREDIT_NOTE_DETAILS_ROUTE, ERROR_404_ROUTE } from '~/core/router'
import { serializeCreditNoteInput } from '~/core/serializers'
import { deserializeAmount } from '~/core/serializers/serializeAmount'
import {
Expand All @@ -25,7 +25,6 @@ import {
useCreateCreditNoteMutation,
useGetInvoiceCreateCreditNoteQuery,
} from '~/generated/graphql'
import { CustomerInvoiceDetailsTabsOptionsEnum } from '~/layouts/CustomerInvoiceDetails'

gql`
fragment InvoiceFee on Fee {
Expand Down Expand Up @@ -151,10 +150,10 @@ export const useCreateCreditNote: () => UseCreateCreditNoteReturn = () => {
})

navigate(
generatePath(CUSTOMER_INVOICE_DETAILS_ROUTE, {
generatePath(CUSTOMER_INVOICE_CREDIT_NOTE_DETAILS_ROUTE, {
customerId: customerId as string,
invoiceId: invoiceId as string,
tab: CustomerInvoiceDetailsTabsOptionsEnum.overview,
creditNoteId: createCreditNote.id,
}),
)
}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/CreditNoteDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { intlFormatNumber } from '~/core/formats/intlFormatNumber'
import {
CUSTOMER_DETAILS_ROUTE,
CUSTOMER_DETAILS_TAB_ROUTE,
CUSTOMER_INVOICE_CREATE_CREDIT_NOTE_ROUTE,
CUSTOMER_INVOICE_DETAILS_ROUTE,
} from '~/core/router'
import { deserializeAmount } from '~/core/serializers/serializeAmount'
Expand Down Expand Up @@ -248,6 +249,7 @@ const CreditNoteDetails = () => {
customerId: customerId as string,
tab: CustomerDetailsTabsOptions.creditNotes,
}),
{ exclude: [CUSTOMER_INVOICE_CREATE_CREDIT_NOTE_ROUTE] },
)
}
/>
Expand Down

0 comments on commit 92f043e

Please sign in to comment.