2017-11-29 4 views
0

콘솔에서이 오류가 발생합니다. .... 그러나 그것은 그들의 문서에있는 무엇, "const를 클라이언트 = 새로운 클라이언트 (구성)"shopify js api를 사용하기 시작하고 각도 응용 프로그램을 실행하려고 할 때 오류가 발생합니다.

__WEBPACK_IMPORTED_MODULE_1_shopify_buy는 ___ default.a는

import Client, {Config} from 'shopify-buy'; 

    const config = new Config({ 
     domain: 'something.myshopify.com', 
     accessToken: 'xxxxxxxxxxxxxxxxxxx', 
     appId : x 
    }); 

    const client = new Client(config); 

가 소리지르는 것 같다 생성자 아니다 . 내가 뭔가 잘못하고 있는거야? 그렇다면 어떻게 해결할 수 있습니까?

답변

0

이 문서는 테스트하지 않았지만 문서에서 다음과 같이 할 수 있습니다. 이 도움이 될 것입니다

import ShopifyBuy from 'shopify-buy'; 
 

 
const shopClient = ShopifyBuy.buildClient({ 
 
    apiKey: 'xxxxxxxxxxxxxxxxxxxx1403c107adc7e', 
 
    domain: 'xxxxxxxxxxxxxxxx.myshopify.com', 
 
    appId: '6', 
 
}); 
 

 
export function fetchAllProducts() { 
 
    return new Promise((resolve, reject) => { 
 
    shopClient.fetchAllProducts() 
 
     .then((data) => { 
 
     console.log('shopClient.fetchAllProducts', data); 
 
     resolve(data); 
 
     }).catch((error) => { 
 
     console.error(new Error('Fetching products error!')); 
 
     reject(error); 
 
     }); 
 
    }); 
 
}

희망.