fix: the rest of sdk rename issues (#7631)
This commit is contained in:
@@ -245,7 +245,7 @@ export const useCreateProduct = (
|
||||
>
|
||||
) => {
|
||||
return useMutation({
|
||||
mutationFn: (payload: any) => sdk.admin.products.create(payload),
|
||||
mutationFn: (payload: any) => sdk.admin.product.create(payload),
|
||||
onSuccess: (data: any, variables: any, context: any) => {
|
||||
queryClient.invalidateQueries({ queryKey: productsQueryKeys.lists() })
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
|
||||
@@ -7,7 +7,7 @@ import { queryClient } from "../../../lib/query-client"
|
||||
|
||||
const collectionDetailQuery = (id: string) => ({
|
||||
queryKey: collectionsQueryKeys.detail(id),
|
||||
queryFn: async () => sdk.admin.collection.retrieve(id),
|
||||
queryFn: async () => sdk.admin.productCollection.retrieve(id),
|
||||
})
|
||||
|
||||
export const collectionLoader = async ({ params }: LoaderFunctionArgs) => {
|
||||
|
||||
@@ -94,14 +94,14 @@ export const ProductCreateForm = () => {
|
||||
const fileReqs = []
|
||||
if (thumbnailReq) {
|
||||
fileReqs.push(
|
||||
sdk.admin.uploads
|
||||
sdk.admin.upload
|
||||
.create({ files: [thumbnailReq.file] })
|
||||
.then((r) => r.files.map((f) => ({ ...f, isThumbnail: true })))
|
||||
)
|
||||
}
|
||||
if (otherMediaReq?.length) {
|
||||
fileReqs.push(
|
||||
sdk.admin.uploads
|
||||
sdk.admin.upload
|
||||
.create({
|
||||
files: otherMediaReq.map((m) => m.file),
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ export const ProductCreateOrganizationSection = ({
|
||||
|
||||
const collections = useComboboxData({
|
||||
queryKey: ["product_collections"],
|
||||
queryFn: sdk.admin.collection.list,
|
||||
queryFn: sdk.admin.productCollection.list,
|
||||
getOptions: (data) =>
|
||||
data.collections.map((collection) => ({
|
||||
label: collection.title!,
|
||||
|
||||
@@ -55,7 +55,7 @@ export const EditProductMediaForm = ({ product }: ProductMediaViewProps) => {
|
||||
let uploaded: HttpTypes.AdminFile[] = []
|
||||
|
||||
if (filesToUpload.length) {
|
||||
const { files: uploads } = await sdk.admin.uploads
|
||||
const { files: uploads } = await sdk.admin.upload
|
||||
.create({ files: filesToUpload.map((m) => m.file) })
|
||||
.catch(() => {
|
||||
form.setError("media", {
|
||||
|
||||
@@ -34,7 +34,7 @@ export const ProductOrganizationForm = ({
|
||||
|
||||
const collections = useComboboxData({
|
||||
queryKey: ["product_collections"],
|
||||
queryFn: sdk.admin.collection.list,
|
||||
queryFn: sdk.admin.productCollection.list,
|
||||
getOptions: (data) =>
|
||||
data.collections.map((collection) => ({
|
||||
label: collection.title!,
|
||||
|
||||
Reference in New Issue
Block a user