fix(dashboard,types): Fix TS errors (#10457)
**What** - Fixes TS erros in dashboard project - Updates incorrect HTTP Invite types - Fixes incorrectly formatted dates in dashboard
This commit is contained in:
committed by
GitHub
parent
55f5ce4690
commit
864f53011b
@@ -1,11 +1,14 @@
|
||||
import { UseMutationOptions, useMutation } from "@tanstack/react-query"
|
||||
import { FetchError } from "@medusajs/js-sdk"
|
||||
import { sdk } from "../../lib/client"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { UseMutationOptions, useMutation } from "@tanstack/react-query"
|
||||
import { sdk } from "../../lib/client"
|
||||
|
||||
export const useSignInWithEmailPass = (
|
||||
options?: UseMutationOptions<
|
||||
string,
|
||||
| string
|
||||
| {
|
||||
location: string
|
||||
},
|
||||
FetchError,
|
||||
HttpTypes.AdminSignUpWithEmailPassword
|
||||
>
|
||||
|
||||
@@ -208,14 +208,13 @@ export const useAddClaimInboundItems = (
|
||||
id: string,
|
||||
orderId: string,
|
||||
options?: UseMutationOptions<
|
||||
HttpTypes.AdminClaimResponse,
|
||||
HttpTypes.AdminClaimReturnPreviewResponse,
|
||||
FetchError,
|
||||
HttpTypes.AdminAddClaimInboundItems
|
||||
>
|
||||
) => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: HttpTypes.AdminAddClaimInboundItems) =>
|
||||
sdk.admin.claim.addInboundItems(id, payload),
|
||||
mutationFn: (payload) => sdk.admin.claim.addInboundItems(id, payload),
|
||||
onSuccess: (data: any, variables: any, context: any) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ordersQueryKeys.details(),
|
||||
|
||||
@@ -37,7 +37,7 @@ export const useCollection = (
|
||||
}
|
||||
|
||||
export const useCollections = (
|
||||
query?: FindParams & HttpTypes.AdminCollectionFilters,
|
||||
query?: FindParams & HttpTypes.AdminCollectionListParams,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
PaginatedResponse<{ collections: HttpTypes.AdminCollection[] }>,
|
||||
@@ -60,7 +60,7 @@ export const useCollections = (
|
||||
export const useUpdateCollection = (
|
||||
id: string,
|
||||
options?: UseMutationOptions<
|
||||
{ collection: HttpTypes.AdminCollection },
|
||||
HttpTypes.AdminCollectionResponse,
|
||||
FetchError,
|
||||
HttpTypes.AdminUpdateCollection
|
||||
>
|
||||
@@ -82,7 +82,7 @@ export const useUpdateCollection = (
|
||||
export const useUpdateCollectionProducts = (
|
||||
id: string,
|
||||
options?: UseMutationOptions<
|
||||
{ collection: HttpTypes.AdminCollection },
|
||||
HttpTypes.AdminCollectionResponse,
|
||||
FetchError,
|
||||
HttpTypes.AdminUpdateCollectionProducts
|
||||
>
|
||||
@@ -110,7 +110,7 @@ export const useUpdateCollectionProducts = (
|
||||
|
||||
export const useCreateCollection = (
|
||||
options?: UseMutationOptions<
|
||||
{ collection: HttpTypes.AdminCollection },
|
||||
HttpTypes.AdminCollectionResponse,
|
||||
FetchError,
|
||||
HttpTypes.AdminCreateCollection
|
||||
>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import {
|
||||
AdminInviteResponse,
|
||||
HttpTypes,
|
||||
PaginatedResponse,
|
||||
} from "@medusajs/types"
|
||||
import { FetchError } from "@medusajs/js-sdk"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import {
|
||||
QueryKey,
|
||||
UseMutationOptions,
|
||||
@@ -13,7 +10,6 @@ import {
|
||||
import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { FetchError } from "@medusajs/js-sdk"
|
||||
|
||||
const INVITES_QUERY_KEY = "invites" as const
|
||||
const invitesQueryKeys = queryKeysFactory(INVITES_QUERY_KEY)
|
||||
@@ -22,9 +18,9 @@ export const useInvite = (
|
||||
id: string,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
{ invite: HttpTypes.AdminInviteResponse },
|
||||
HttpTypes.AdminInviteResponse,
|
||||
FetchError,
|
||||
{ invite: HttpTypes.AdminInviteResponse },
|
||||
HttpTypes.AdminInviteResponse,
|
||||
QueryKey
|
||||
>,
|
||||
"queryFn" | "queryKey"
|
||||
@@ -43,9 +39,9 @@ export const useInvites = (
|
||||
query?: Record<string, any>,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
PaginatedResponse<{ invites: HttpTypes.AdminInviteResponse[] }>,
|
||||
HttpTypes.AdminInviteListResponse,
|
||||
FetchError,
|
||||
PaginatedResponse<{ invites: HttpTypes.AdminInviteResponse[] }>,
|
||||
HttpTypes.AdminInviteListResponse,
|
||||
QueryKey
|
||||
>,
|
||||
"queryFn" | "queryKey"
|
||||
@@ -62,7 +58,7 @@ export const useInvites = (
|
||||
|
||||
export const useCreateInvite = (
|
||||
options?: UseMutationOptions<
|
||||
{ invite: AdminInviteResponse },
|
||||
HttpTypes.AdminInviteResponse,
|
||||
FetchError,
|
||||
HttpTypes.AdminCreateInvite
|
||||
>
|
||||
@@ -79,11 +75,7 @@ export const useCreateInvite = (
|
||||
|
||||
export const useResendInvite = (
|
||||
id: string,
|
||||
options?: UseMutationOptions<
|
||||
{ invite: AdminInviteResponse },
|
||||
FetchError,
|
||||
void
|
||||
>
|
||||
options?: UseMutationOptions<HttpTypes.AdminInviteResponse, FetchError, void>
|
||||
) => {
|
||||
return useMutation({
|
||||
mutationFn: () => sdk.admin.invite.resend(id),
|
||||
@@ -118,7 +110,7 @@ export const useDeleteInvite = (
|
||||
export const useAcceptInvite = (
|
||||
inviteToken: string,
|
||||
options?: UseMutationOptions<
|
||||
{ user: HttpTypes.AdminUserResponse },
|
||||
HttpTypes.AdminAcceptInviteResponse,
|
||||
FetchError,
|
||||
HttpTypes.AdminAcceptInvite & { auth_token: string }
|
||||
>
|
||||
|
||||
@@ -128,7 +128,7 @@ export const useBatchPriceListPrices = (
|
||||
id: string,
|
||||
query?: HttpTypes.AdminPriceListParams,
|
||||
options?: UseMutationOptions<
|
||||
HttpTypes.AdminPriceListResponse,
|
||||
HttpTypes.AdminPriceListBatchResponse,
|
||||
FetchError,
|
||||
HttpTypes.AdminBatchPriceListPrice
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user