Regarding Storefront Api for customer

Highlighted
New Member
1 0 0

Hi, 

I am developing an iOS app using Shopify storefront api using Mobile Buy SDK version 5.1.0 and having issue with customer api. I have logged in to the app and i got access token every time but sometimes "queryForCustomer" api does not responds. we used below code.

return Storefront.buildQuery { $0

            .customer(customerAccessToken: accessToken) { $0

                .id()

                .displayName()

                .email()

                .firstName()

                .lastName()

                .phone()

                .updatedAt()

                .orders(first: Int32(limit), after: cursor) { $0

                    .fragmentForStandardOrder()

                }

            }

        }

// ----------------------------------------------------------------------------------

self.client.queryGraphWith(query, cachePolicy: .networkOnly)

{ (query, error) in

            error.debugPrint()

            debugPrint("query",query!)

            

            if let customer = query?.customer {

                let viewModel   = customer.viewModel

                let collections = PageableArray(

                    with:     customer.orders.edges,

                    pageInfo: customer.orders.pageInfo

                )

                completion((viewModel, collections))

            } else {

                print("Failed to load customer and orders: \(String(describing: error))")

                completion(nil)

            }

        }

 

Below is the api response:

<QueryRoot: ["customer": <null>]>

"Failed to load customer and orders: nil"

 

Please assist me on this. I look forward to hear from you soon on this.

 

Thanks,

Tushar

0 Likes