File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed
Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 11{
2- "version" : " 0.27.5 " ,
2+ "version" : " 0.28.0 " ,
33 "license" : " MIT" ,
44 "main" : " dist/index.js" ,
55 "typings" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -269,4 +269,48 @@ export class FileSystem {
269269 }
270270 return response . data . data . updateCompanyPhotoProfile as CompanyInterface ;
271271 }
272+
273+ public async updateCompanyBranchPhotoProfile (
274+ data : File ,
275+ branch_id : string
276+ ) : Promise < any > {
277+ if ( ! this . options || ! this . axiosClient ) {
278+ throw new Error ( 'FileSystem module not initialized' ) ;
279+ }
280+
281+ const query = `
282+ id
283+ uuid
284+ name
285+ custom_fields(orderBy: [{ column: UPDATED_AT, order: DESC }]) {
286+ data {
287+ name
288+ value
289+ }
290+ }
291+ photo {
292+ url
293+ }
294+ ` ;
295+
296+ const operations = {
297+ query : `mutation ($file: Upload!) {
298+ updateCompanyPhotoProfile(file: $file, id: "${ branch_id } ") { ${ query } }
299+ }` ,
300+ variables : { file : null } ,
301+ } ;
302+
303+ const formData = new FormData ( ) ;
304+ formData . append ( 'operations' , JSON . stringify ( operations ) ) ;
305+ formData . append ( 'map' , JSON . stringify ( { '0' : [ 'variables.file' ] } ) ) ;
306+ formData . append ( '0' , data , data . name ) ;
307+
308+ const response = await this . axiosClient . post ( '' , formData ) ;
309+
310+ if ( response . data . errors ) {
311+ throw new Error ( response . data . errors [ 0 ] . message ) ;
312+ }
313+
314+ return response . data ;
315+ }
272316}
You can’t perform that action at this time.
0 commit comments