@@ -32,6 +32,7 @@ export const defaultStore = defineStore('default', {
3232 } ) ,
3333 getters : {
3434 getUser : ( state ) => state . user ,
35+ getActs : ( state ) => state . acts ,
3536 getNetworkTable : ( state ) => state . network ,
3637 getPaginationInfo : ( state ) => state . pagination ,
3738 getCustomersTable : ( state ) => state . customers ,
@@ -170,20 +171,16 @@ export const defaultStore = defineStore('default', {
170171 } ,
171172 async getCustomersList ( ) {
172173 let cache
173- // let responseHeader
174174 const headers = { 'Authorization' : `Bearer ${ this . user . token } ` }
175175 await axios . get ( `http://${ this . BACKEND } /api/v1/ldap3/users/count` , { headers } ) . then (
176176 function ( response ) {
177177 cache = response . data
178- console . log ( cache )
179- // responseHeader = response.headers['x-customers-count']
180178 }
181179 ) . catch ( function ( error ) {
182180 console . log ( error )
183181 localStorage . removeItem ( "isActive" )
184182 localStorage . removeItem ( "token" )
185183 } )
186- // this.customers.customersAll = cache
187184 localStorage . customersCount = cache
188185 return cache
189186 } ,
@@ -243,23 +240,25 @@ export const defaultStore = defineStore('default', {
243240 console . log ( error )
244241 } )
245242 } ,
246- async UploadAct ( data , customer ) {
243+ async UploadAct ( data , customer , description ) {
247244 const headers = { 'Authorization' : `Bearer ${ this . user . token } ` , 'Content-Type' : 'multipart/form-data' }
248245 let formData = new FormData ( )
246+ let params = { 'name' : description }
249247 formData . append ( 'file' , data )
250- await axios . post ( `http://${ this . BACKEND } /api/v1/files/act/${ customer } /upload` , formData , { headers } ) . then (
248+ await axios . post ( `http://${ this . BACKEND } /api/v1/files/act/${ customer } /upload` , formData , { headers, params } ) . then (
251249 function ( response ) {
252250 console . log ( response )
253251 }
254252 ) . catch ( function ( error ) {
255253 console . log ( error )
256254 } )
257255 } ,
258- async ChangeAct ( data , customer ) {
256+ async ChangeAct ( data , customer , description ) {
259257 const headers = { 'Authorization' : `Bearer ${ this . user . token } ` , 'Content-Type' : 'multipart/form-data' }
260258 let formData = new FormData ( )
259+ let params = { 'name' : description }
261260 formData . append ( 'file' , data )
262- await axios . put ( `http://${ this . BACKEND } /api/v1/files/act/${ customer } /change` , formData , { headers } ) . then (
261+ await axios . put ( `http://${ this . BACKEND } /api/v1/files/act/${ customer } /change` , formData , { headers, params } ) . then (
263262 function ( response ) {
264263 console . log ( response )
265264 }
@@ -291,5 +290,17 @@ export const defaultStore = defineStore('default', {
291290 console . log ( error )
292291 } )
293292 } ,
293+ async getActsTable ( ) {
294+ let responseData = [ ]
295+ const headers = { 'Authorization' : `Bearer ${ this . user . token } ` }
296+ await axios . get ( `http://${ this . BACKEND } /api/v1/files/acts` , { headers } ) . then (
297+ function ( response ) {
298+ responseData = response . data
299+ }
300+ ) . catch ( function ( error ) {
301+ console . log ( error )
302+ } )
303+ return responseData
304+ }
294305 } ,
295306} )
0 commit comments