fix(dashboard): user invite search (#9973)

**What**
- fix prefix for table search which caused the other table rendered on the page to fire query
- additionally, fix a typo in js SDK and only format the file

---

FIXES SUP-112
CLOSES https://github.com/medusajs/medusa/issues/9968
This commit is contained in:
Frane Polić authored and GitHub committed 2024-11-07 19:13:28 +00:00
1 parent 1a0882cc01
commit 576da17da3
2 files changed
+73 -69

No files matched your search

@@ -32,7 +32,7 @@ import {
} from "../../../../../hooks/api/invites"
import { useUserInviteTableQuery } from "../../../../../hooks/table/query/use-user-invite-table-query"
import { useDataTable } from "../../../../../hooks/use-data-table"
import { isFetchError } from "../../../../../lib/is-fetch-error.ts"
import { isFetchError } from "../../../../../lib/is-fetch-error"
const InviteUserSchema = zod.object({
email: zod.string().email(),
@@ -168,6 +168,7 @@ export const InviteUserForm = () => {
search="autofocus"
isLoading={isLoading}
queryObject={raw}
prefix={PREFIX}
orderBy={[
{ key: "email", label: t("fields.email") },
{ key: "created_at", label: t("fields.createdAt") },
+71 -68
View File
@@ -1,8 +1,4 @@
import {
FindParams,
HttpTypes,
SelectParams,
} from "@medusajs/types"
import { FindParams, HttpTypes, SelectParams } from "@medusajs/types"
import { Client } from "../client"
import { ClientHeaders } from "../types"
@@ -72,12 +68,13 @@ export class Store {
query?: FindParams & HttpTypes.StoreRegionFilters,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreRegionListResponse
>(`/store/regions`, {
return this.client.fetch<HttpTypes.StoreRegionListResponse>(
`/store/regions`,
{
query,
headers,
})
}
)
},
/**
* This method retrieves a region by its ID. It sends a request to the [Get Region](https://docs.medusajs.com/api/store#regions_getregionsid)
@@ -184,12 +181,13 @@ export class Store {
query?: FindParams & HttpTypes.StoreCollectionFilters,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCollectionListResponse
>(`/store/collections`, {
return this.client.fetch<HttpTypes.StoreCollectionListResponse>(
`/store/collections`,
{
query,
headers,
})
}
)
},
/**
* This method retrieves a collection by its ID. It sends a request to the [Get Collection](https://docs.medusajs.com/api/store#collections_getcollectionsid)
@@ -249,10 +247,10 @@ export class Store {
*
* @param query - Filters and pagination configurations.
* @param headers - Headers to pass in the request.
* @returns The paginated list of categoreis.
* @returns The paginated list of categories.
*
* @example
* To retrieve the list of categoreis:
* To retrieve the list of categories:
*
* ```ts
* sdk.store.category.list()
@@ -293,12 +291,13 @@ export class Store {
query?: FindParams & HttpTypes.StoreProductCategoryListParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreProductCategoryListResponse
>(`/store/product-categories`, {
return this.client.fetch<HttpTypes.StoreProductCategoryListResponse>(
`/store/product-categories`,
{
query,
headers,
})
}
)
},
/**
* This method retrieves a category by its ID. It sends a request to the
@@ -339,12 +338,13 @@ export class Store {
query?: HttpTypes.StoreProductCategoryParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreProductCategoryResponse
>(`/store/product-categories/${id}`, {
return this.client.fetch<HttpTypes.StoreProductCategoryResponse>(
`/store/product-categories/${id}`,
{
query,
headers,
})
}
)
},
}
@@ -762,13 +762,14 @@ export class Store {
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCompleteCartResponse
>(`/store/carts/${cartId}/complete`, {
return this.client.fetch<HttpTypes.StoreCompleteCartResponse>(
`/store/carts/${cartId}/complete`,
{
method: "POST",
headers,
query,
})
}
)
},
}
@@ -796,12 +797,13 @@ export class Store {
query?: HttpTypes.StoreGetShippingOptionList,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreShippingOptionListResponse
>(`/store/shipping-options`, {
return this.client.fetch<HttpTypes.StoreShippingOptionListResponse>(
`/store/shipping-options`,
{
headers,
query,
})
}
)
},
}
@@ -866,12 +868,13 @@ export class Store {
query?: FindParams & HttpTypes.StorePaymentProviderFilters,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StorePaymentProviderListResponse
>(`/store/payment-providers`, {
return this.client.fetch<HttpTypes.StorePaymentProviderListResponse>(
`/store/payment-providers`,
{
headers,
query,
})
}
)
},
/**
@@ -917,24 +920,26 @@ export class Store {
cart_id: cart.id,
}
paymentCollectionId = (
await this.client.fetch<
HttpTypes.StorePaymentCollectionResponse
>(`/store/payment-collections`, {
await this.client.fetch<HttpTypes.StorePaymentCollectionResponse>(
`/store/payment-collections`,
{
method: "POST",
headers,
body: collectionBody,
})
}
)
).payment_collection.id
}
return this.client.fetch<
HttpTypes.StorePaymentCollectionResponse
>(`/store/payment-collections/${paymentCollectionId}/payment-sessions`, {
return this.client.fetch<HttpTypes.StorePaymentCollectionResponse>(
`/store/payment-collections/${paymentCollectionId}/payment-sessions`,
{
method: "POST",
headers,
body,
query,
})
}
)
},
}
@@ -990,12 +995,13 @@ export class Store {
query?: HttpTypes.StoreOrderFilters,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreOrderListResponse
>(`/store/orders`, {
return this.client.fetch<HttpTypes.StoreOrderListResponse>(
`/store/orders`,
{
query,
headers,
})
}
)
},
/**
* This method retrieves an order by its ID. It sends a request to the
@@ -1083,14 +1089,15 @@ export class Store {
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCustomerResponse
>(`/store/customers`, {
return this.client.fetch<HttpTypes.StoreCustomerResponse>(
`/store/customers`,
{
method: "POST",
headers,
body,
query,
})
}
)
},
/**
* This method updates the logged-in customer's details. The customer must be logged in
@@ -1119,9 +1126,7 @@ export class Store {
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCustomerResponse
>(
return this.client.fetch<HttpTypes.StoreCustomerResponse>(
`/store/customers/me`,
{
method: "POST",
@@ -1184,14 +1189,15 @@ export class Store {
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCustomerResponse
>(`/store/customers/me/addresses`, {
return this.client.fetch<HttpTypes.StoreCustomerResponse>(
`/store/customers/me/addresses`,
{
method: "POST",
headers,
body,
query,
})
}
)
},
/**
* This method updates the address of the logged-in customer. The customer must be logged in
@@ -1225,9 +1231,7 @@ export class Store {
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCustomerResponse
>(
return this.client.fetch<HttpTypes.StoreCustomerResponse>(
`/store/customers/me/addresses/${addressId}`,
{
method: "POST",
@@ -1292,12 +1296,13 @@ export class Store {
query?: FindParams & HttpTypes.StoreCustomerAddressFilters,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCustomerAddressListResponse
>(`/store/customers/me/addresses`, {
return this.client.fetch<HttpTypes.StoreCustomerAddressListResponse>(
`/store/customers/me/addresses`,
{
query,
headers,
})
}
)
},
/**
* This method retrieves an address of the logged-in customer. The customer must be logged in
@@ -1346,9 +1351,7 @@ export class Store {
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
HttpTypes.StoreCustomerAddressResponse
>(
return this.client.fetch<HttpTypes.StoreCustomerAddressResponse>(
`/store/customers/me/addresses/${addressId}`,
{
query,