Untitled

 avatar
unknown
plain_text
2 years ago
1.5 kB
4
Indexable
importNodesArray() {
    let dataArray = JSON.parse(this.cSVJSONUtilityLib.convertRowCSVToJS(this.fileContentString, true));
    console.log(dataArray);
    this.appService.masterWrapperAdmin({
        params: {
            'allparameters': dataArray,
            'allconfig': this.commonUtilitiesLib.copy({
                'verbtype': 'post',
                'apiname': ['ADMINUSERNODENAMES;'],
                'responseformat': {
                    'format': 'rest'
                }
            })
        }
    }).subscribe(
        (success: any) => {
            // Check the message code in the success response
            if (success.messageCode === 'SUCCESS') {
                this.toastr.success('Import Successful');
                this.router.navigate(['/admin', 'list', 'all']);
            } else {
                // Handle specific error codes
                switch (success.messageCode) {
                    case 'ERROR_CODE_1':
                        // Handle error code 1
                        break;
                    case 'ERROR_CODE_2':
                        // Handle error code 2
                        break;
                    // Add more cases for different error codes if needed
                    default:
                        // Handle other error codes
                        break;
                }
            }
        },
        (error: any) => {
            // Handle general error case
            console.error(error);
        }
    );
}
Editor is loading...