File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -205,14 +205,19 @@ class Asset extends Base {
205205 });
206206 * @return {external:Promise }
207207 */
208- publish ( payload ) {
208+ publish ( payload : { [ key : string ] : any } , api_version : string = "" ) {
209209 if (
210210 ! payload ||
211211 typeof payload !== "object" ||
212212 payload instanceof Array
213213 ) {
214214 return Promise . reject ( new Error ( "Kindly provide valid parameters" ) ) ;
215215 }
216+
217+ if ( api_version !== "" ) {
218+ payload = { ...payload , headers : { api_version } } ;
219+ }
220+
216221 return this . fetch ( "publishAsset" , payload ) ;
217222 }
218223
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ export default class Base {
6161 }
6262
6363 fetch ( action : string , payload ?: { [ key : string ] : any } ) {
64+ console . log ( 'fetch------->' , action , payload ) ;
6465 const options = {
6566 payload,
6667 content_type_uid : this . constructor . contentTypeUid ,
@@ -69,6 +70,12 @@ export default class Base {
6970 action : action || `get${ this . constructor . module ( ) } `
7071 } ;
7172
73+ if ( ( action === 'publishEntry' || action === 'publishAsset' ) && payload ?. headers && Object . keys ( payload . headers ) . length > 0 ) {
74+ options . headers = payload . headers ;
75+ }
76+
77+ console . log ( 'options before cleanup------->' , options ) ;
78+
7279 if ( ! payload ) { delete options . payload ; }
7380 if ( ! this . constructor . contentTypeUid ) { delete options . content_type_uid ; }
7481 return this . constructor . connection . sendToParent ( 'stackQuery' , options )
Original file line number Diff line number Diff line change @@ -269,14 +269,19 @@ class Entry extends Base {
269269 }).then(...).catch(...);
270270 * @return {external:Promise }
271271 */
272- publish ( payload : { [ key : string ] : any } ) {
272+ publish ( payload : { [ key : string ] : any } , api_version : string = "" ) {
273273 if (
274274 ! payload ||
275275 typeof payload !== "object" ||
276276 payload instanceof Array
277277 ) {
278278 return Promise . reject ( new Error ( "Kindly provide valid parameters" ) ) ;
279279 }
280+
281+ if ( api_version !== "" ) {
282+ payload = { ...payload , headers : { api_version } } ;
283+ }
284+
280285 this . _query = { } ;
281286 return this . fetch ( "publishEntry" , payload ) ;
282287 }
You can’t perform that action at this time.
0 commit comments