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