@@ -3,15 +3,15 @@ import { API_VERSION, EXECUTION_LOGS_ERROR_TEXT } from '../../utilities/constant
33import { getDataFromLocalStorage } from '../../utilities/functions' ;
44import { getCall , postCall , putCall , patchCall } from './service' ;
55
6- const options = {
6+ const options = ( ) => ( {
77 headers : {
88 app_token : getDataFromLocalStorage ( 'app_token' )
99 }
10- } ;
10+ } ) ;
1111
1212export const getMigrationData = ( orgId : string , projectId : string ) => {
1313 try {
14- return getCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } / ` , options ) ;
14+ return getCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } ` , options ( ) ) ;
1515 } catch ( error ) {
1616 if ( error instanceof Error ) {
1717 throw new Error ( `Error in getting migrationData: ${ error . message } ` ) ;
@@ -23,7 +23,7 @@ export const getMigrationData = (orgId: string, projectId: string) => {
2323
2424export const updateLegacyCMSData = ( orgId : string , projectId : string , data : ObjectType ) => {
2525 try {
26- return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /legacy-cms` , data , options ) ;
26+ return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /legacy-cms` , data , options ( ) ) ;
2727 } catch ( error ) {
2828 if ( error instanceof Error ) {
2929 throw new Error ( `${ error . message } ` ) ;
@@ -35,7 +35,7 @@ export const updateLegacyCMSData = (orgId: string, projectId: string, data: Obje
3535
3636export const updateAffixData = ( orgId : string , projectId : string , data : ObjectType ) => {
3737 try {
38- return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /affix` , data , options ) ;
38+ return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /affix` , data , options ( ) ) ;
3939 } catch ( error ) {
4040 if ( error instanceof Error ) {
4141 throw new Error ( `${ error . message } ` ) ;
@@ -47,7 +47,7 @@ export const updateAffixData = (orgId: string, projectId: string, data: ObjectTy
4747
4848export const updateFileFormatData = ( orgId : string , projectId : string , data : ObjectType ) => {
4949 try {
50- return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /file-format` , data , options ) ;
50+ return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /file-format` , data , options ( ) ) ;
5151 } catch ( error ) {
5252 if ( error instanceof Error ) {
5353 throw new Error ( `${ error . message } ` ) ;
@@ -62,7 +62,7 @@ export const updateDestinationStack = (orgId: string, projectId: string, data: O
6262 return putCall (
6363 `${ API_VERSION } /org/${ orgId } /project/${ projectId } /destination-stack` ,
6464 data ,
65- options
65+ options ( )
6666 ) ;
6767 } catch ( error ) {
6868 if ( error instanceof Error ) {
@@ -75,7 +75,7 @@ export const updateDestinationStack = (orgId: string, projectId: string, data: O
7575
7676export const updateCurrentStepData = ( orgId : string , projectId : string , data : ObjectType = { } ) => {
7777 try {
78- return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /current-step` , data , options ) ;
78+ return putCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /current-step` , data , options ( ) ) ;
7979 } catch ( error ) {
8080 if ( error instanceof Error ) {
8181 throw new Error ( `${ error . message } ` ) ;
@@ -90,7 +90,7 @@ export const affixConfirmation = (orgId: string, projectId: string, data: Object
9090 return putCall (
9191 `${ API_VERSION } /org/${ orgId } /project/${ projectId } /affix_confirmation` ,
9292 data ,
93- options
93+ options ( )
9494 ) ;
9595 } catch ( error ) {
9696 return error ;
@@ -102,7 +102,7 @@ export const fileformatConfirmation = (orgId: string, projectId: string, data: O
102102 return putCall (
103103 `${ API_VERSION } /org/${ orgId } /project/${ projectId } /fileformat_confirmation` ,
104104 data ,
105- options
105+ options ( )
106106 ) ;
107107 } catch ( error ) {
108108 return error ;
@@ -119,7 +119,7 @@ export const getContentTypes = (
119119 const encodedSearchText = encodeURIComponent ( searchText ) ;
120120 return getCall (
121121 `${ API_VERSION } /mapper/contentTypes/${ projectId } /${ skip } /${ limit } /${ encodedSearchText } ?` ,
122- options
122+ options ( )
123123 ) ;
124124 } catch ( error ) {
125125 if ( error instanceof Error ) {
@@ -141,7 +141,7 @@ export const getFieldMapping = async (
141141 const encodedSearchText = encodeURIComponent ( searchText ) ;
142142 return await getCall (
143143 `${ API_VERSION } /mapper/fieldMapping/${ projectId } /${ contentTypeId } /${ skip } /${ limit } /${ encodedSearchText } ?` ,
144- options
144+ options ( )
145145 ) ;
146146 } catch ( error ) {
147147 if ( error instanceof Error ) {
@@ -187,7 +187,7 @@ export const updateContentType = async (
187187 return await putCall (
188188 `${ API_VERSION } /mapper/contentTypes/${ orgId } /${ projectId } /${ contentTypeId } ` ,
189189 data ,
190- options
190+ options ( )
191191 ) ;
192192 } catch ( error ) {
193193 if ( error instanceof Error ) {
@@ -208,7 +208,7 @@ export const resetToInitialMapping = async (
208208 return await putCall (
209209 `${ API_VERSION } /mapper/resetFields/${ orgId } /${ projectId } /${ contentTypeId } ` ,
210210 data ,
211- options
211+ options ( )
212212 ) ;
213213 } catch ( error ) {
214214 if ( error instanceof Error ) {
@@ -221,7 +221,7 @@ export const resetToInitialMapping = async (
221221
222222export const getExistingContentTypes = async ( projectId : string , contentTypeUid ?: string ) => {
223223 try {
224- return await getCall ( `${ API_VERSION } /mapper/${ projectId } /contentTypes/${ contentTypeUid ?? '' } ` , options ) ;
224+ return await getCall ( `${ API_VERSION } /mapper/${ projectId } /contentTypes/${ contentTypeUid ?? '' } ` , options ( ) ) ;
225225 } catch ( error ) {
226226 if ( error instanceof Error ) {
227227 throw new Error ( `${ error . message } ` ) ;
@@ -233,7 +233,7 @@ export const getExistingContentTypes = async (projectId: string, contentTypeUid?
233233
234234export const getExistingGlobalFields = async ( projectId : string , globalFieldUid ?: string ) => {
235235 try {
236- return await getCall ( `${ API_VERSION } /mapper/${ projectId } /globalFields/${ globalFieldUid ?? '' } ` , options ) ;
236+ return await getCall ( `${ API_VERSION } /mapper/${ projectId } /globalFields/${ globalFieldUid ?? '' } ` , options ( ) ) ;
237237 } catch ( error ) {
238238 if ( error instanceof Error ) {
239239 throw new Error ( `${ error . message } ` ) ;
@@ -246,7 +246,7 @@ export const getExistingGlobalFields = async (projectId: string, globalFieldUid?
246246
247247export const removeContentMapper = async ( orgId : string , projectId : string ) => {
248248 try {
249- return await getCall ( `${ API_VERSION } /mapper/${ orgId } /${ projectId } /content-mapper` , options ) ;
249+ return await getCall ( `${ API_VERSION } /mapper/${ orgId } /${ projectId } /content-mapper` , options ( ) ) ;
250250 } catch ( error ) {
251251 return error ;
252252
@@ -264,7 +264,7 @@ export const updateContentMapper = async (
264264 return await patchCall (
265265 `${ API_VERSION } /mapper/${ orgId } /${ projectId } /mapper_keys` ,
266266 mapperKeys ,
267- options
267+ options ( )
268268 ) ;
269269 } catch ( error ) {
270270 if ( error instanceof Error ) {
@@ -278,7 +278,7 @@ export const updateContentMapper = async (
278278export const updateStackDetails = async ( orgId : string , projectId : string , data : ObjectType ) => {
279279 try {
280280 const Data = { stack_details : data } ;
281- return await patchCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /stack-details` , Data , options ) ;
281+ return await patchCall ( `${ API_VERSION } /org/${ orgId } /project/${ projectId } /stack-details` , Data , options ( ) ) ;
282282 } catch ( error ) {
283283 return error ;
284284
@@ -287,7 +287,7 @@ export const updateStackDetails = async (orgId: string, projectId: string, data:
287287
288288export const getOrgDetails = async ( orgId : string ) => {
289289 try {
290- return await getCall ( `${ API_VERSION } /org/${ orgId } /get_org_details` , options ) ;
290+ return await getCall ( `${ API_VERSION } /org/${ orgId } /get_org_details` , options ( ) ) ;
291291 } catch ( error ) {
292292 return error ;
293293 }
@@ -298,7 +298,7 @@ export const createTestStack = async (orgId: string, projectId: string, data: Ob
298298 return await postCall (
299299 `${ API_VERSION } /migration/create-test-stack/${ orgId } /${ projectId } ` ,
300300 data ,
301- options
301+ options ( )
302302 ) ;
303303 } catch ( error ) {
304304 return error ;
@@ -308,7 +308,7 @@ export const createTestStack = async (orgId: string, projectId: string, data: Ob
308308export const createTestMigration = async ( orgId : string , projectId : string ) => {
309309 try {
310310 return await postCall (
311- `${ API_VERSION } /migration/test-stack/${ orgId } /${ projectId } ` , { } , options ) ;
311+ `${ API_VERSION } /migration/test-stack/${ orgId } /${ projectId } ` , { } , options ( ) ) ;
312312 } catch ( error ) {
313313 return error ;
314314 }
@@ -317,7 +317,7 @@ export const createTestMigration = async (orgId: string, projectId: string) => {
317317export const startMigration = async ( orgId : string , projectId : string ) => {
318318 try {
319319 return await postCall (
320- `${ API_VERSION } /migration/start/${ orgId } /${ projectId } ` , { } , options ) ;
320+ `${ API_VERSION } /migration/start/${ orgId } /${ projectId } ` , { } , options ( ) ) ;
321321 } catch ( error ) {
322322 return error ;
323323 }
@@ -326,7 +326,7 @@ export const startMigration = async (orgId: string, projectId: string) => {
326326export const updateMigrationKey = async ( orgId : string , projectId : string ) => {
327327 try {
328328 return await putCall (
329- `${ API_VERSION } /org/${ orgId } /project/${ projectId } /migration-excution` , { } , options ) ;
329+ `${ API_VERSION } /org/${ orgId } /project/${ projectId } /migration-excution` , { } , options ( ) ) ;
330330 } catch ( error ) {
331331 return error ;
332332 }
@@ -335,7 +335,7 @@ export const updateMigrationKey = async (orgId: string, projectId: string) => {
335335export const updateLocaleMapper = async ( projectId : string , data : any ) => {
336336 try {
337337 return await postCall (
338- `${ API_VERSION } /migration/updateLocales/${ projectId } ` , data , options ) ;
338+ `${ API_VERSION } /migration/updateLocales/${ projectId } ` , data , options ( ) ) ;
339339 } catch ( error ) {
340340 return error ;
341341 }
@@ -345,7 +345,7 @@ export const getMigrationLogs = async (orgId: string, projectId: string, stackId
345345 try {
346346 return await getCall (
347347 `${ API_VERSION } /migration/get_migration_logs/${ orgId } /${ projectId } /${ stackId } /${ skip } /${ limit } /${ startIndex } /${ stopIndex } /${ searchText } /${ filter } ` ,
348- options
348+ options ( )
349349 ) ;
350350 } catch ( error ) {
351351 if ( error instanceof Error ) {
0 commit comments