diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index fbbf0400..3e60db8f 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -67,6 +67,10 @@ const endpoints = Object.freeze({ url: '/location/api/v1/location/providers', method: 'GET' }, + // GetTpaProviders: { + // url: '/location/api/v1/location/providers', + // method: 'GET' + // }, GetCapabilityQuestions: { url: '/parts/api/v1/parts/capability-questions', method: 'GET' diff --git a/src/store/index.js b/src/store/index.js index fbbe645a..f928064f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -848,79 +848,87 @@ export const useMainStore = defineStore({ }); }, - // TODO update with real endpoint getTpaProviders(zipCode, radius) { + const damageType = this.damage.isRepair ? 'Repair' : 'Replace'; + const { accountNumber } = this.issConfig; + const safeliteOnly = false; return new Promise((resolve, reject) => { - if (radius === 25) { - resolve({ - data: { - mobileProviderNumber: null, - shopProviders: null - } - }); - } else if (radius === 50) { - resolve({ - data: { - mobileProviderNumber: null, - shopProviders: [ - { - name: 'USA Auto Glass', - address: { - city: 'WESTERVILLE', - country: 'US', - state: 'OH', - streetAddress: '4403 EXECUTIVE PKWY', - streetAddress2: '', - zipCode: '43081', - zipCodeCtu: '01820' - }, - distanceInMiles: 8.393453111956896, - providerNumber: '003335', - phoneNumber: '614-123-5555' - } - ] - } - }); - } else { - resolve({ - data: { - mobileProviderNumber: null, - shopProviders: [ - { - name: 'USA Auto Glass', - address: { - city: 'WESTERVILLE', - country: 'US', - state: 'OH', - streetAddress: '4403 EXECUTIVE PKWY', - streetAddress2: '', - zipCode: '43081', - zipCodeCtu: '01820' - }, - distanceInMiles: 8.393453111956896, - providerNumber: '003335', - phoneNumber: '614-123-5555' - }, - { - name: 'Safelite AutoGlass', - address: { - city: 'WORTHINGTON', - country: 'US', - state: 'OH', - streetAddress: '760 DEARBORN PARK LN', - streetAddress2: '', - zipCode: '43085', - zipCodeCtu: '01820' - }, - distanceInMiles: 8.704336770196678, - providerNumber: '001820', - phoneNumber: '740-555-1234' - } - ] - } - }); - } + globalMethods.callHttpClient({ + method: endpoints.GetProviders.method, + endpoint: `${endpoints.GetProviders.url}/${zipCode}/${damageType}/${radius}/${accountNumber}/${safeliteOnly}` + }).then((response) => resolve(response), (error) => reject(error)); }); + // return new Promise((resolve, reject) => { + // if (radius === 25) { + // resolve({ + // data: { + // mobileProviderNumber: null, + // shopProviders: null + // } + // }); + // } else if (radius === 50) { + // resolve({ + // data: { + // mobileProviderNumber: null, + // shopProviders: [ + // { + // name: 'USA Auto Glass', + // address: { + // city: 'WESTERVILLE', + // country: 'US', + // state: 'OH', + // streetAddress: '4403 EXECUTIVE PKWY', + // streetAddress2: '', + // zipCode: '43081', + // zipCodeCtu: '01820' + // }, + // distanceInMiles: 8.393453111956896, + // providerNumber: '003335', + // phoneNumber: '614-123-5555' + // } + // ] + // } + // }); + // } else { + // resolve({ + // data: { + // mobileProviderNumber: null, + // shopProviders: [ + // { + // name: 'USA Auto Glass', + // address: { + // city: 'WESTERVILLE', + // country: 'US', + // state: 'OH', + // streetAddress: '4403 EXECUTIVE PKWY', + // streetAddress2: '', + // zipCode: '43081', + // zipCodeCtu: '01820' + // }, + // distanceInMiles: 8.393453111956896, + // providerNumber: '003335', + // phoneNumber: '614-123-5555' + // }, + // { + // name: 'Safelite AutoGlass', + // address: { + // city: 'WORTHINGTON', + // country: 'US', + // state: 'OH', + // streetAddress: '760 DEARBORN PARK LN', + // streetAddress2: '', + // zipCode: '43085', + // zipCodeCtu: '01820' + // }, + // distanceInMiles: 8.704336770196678, + // providerNumber: '001820', + // phoneNumber: '740-555-1234' + // } + // ] + // } + // }); + // } + // }); }, async getSupportingItems() {