11import Axios , { AxiosResponse } from 'axios' ;
22
3- import AUTH_CONFIG from '../auth/authConfig' ;
3+ import { AUTH_CONFIG , CHANNEL_ID } from '../auth/authConfig' ;
44import { WidgetConfiguration } from '../schema/schemaParser/schemaParser' ;
55
66export const widgetApi = {
@@ -69,13 +69,13 @@ export const publishWidget = (
6969
7070export const getWidgetTemplate = (
7171 name : string
72- ) : Promise < string > => new Promise ( ( resolve , reject ) =>
72+ ) : Promise < string > => new Promise ( ( resolve , reject ) =>
7373 getAllTemplates ( )
7474 . then ( ( data ) => {
7575 const match = data . find (
7676 template => name === template . name ,
77- ) ;
78-
77+ ) ;
78+
7979 resolve ( match ?. uuid || '' ) ;
8080 } )
8181 . catch ( error => reject ( error ) ) )
@@ -91,7 +91,7 @@ export interface WidgetTemplateResult {
9191 date_modified : string ;
9292 current_version_uuid : string ;
9393 icon_name : string ;
94- }
94+ }
9595
9696const getAllTemplates = async ( page : number = 1 ) : Promise < WidgetTemplateResult [ ] > => {
9797 let listResults : WidgetTemplateResult [ ] = [ ] ;
@@ -105,7 +105,7 @@ const getAllTemplates = async (page: number = 1): Promise<WidgetTemplateResult[]
105105 'X-Auth-Client' : AUTH_CONFIG . authId ,
106106 'X-Auth-Token' : AUTH_CONFIG . authToken ,
107107 } ,
108- url : `${ widgetApi . widgetTemplateList } ?limit=250&page=${ page } ` ,
108+ url : `${ widgetApi . widgetTemplateList } ?limit=250&page=${ page } &channel_id:in= ${ CHANNEL_ID } ` ,
109109 } ) ) . data ;
110110
111111 done = data . length === 0 ;
0 commit comments