Error notification

It’s recommended to notify the user when a problem happens during the call, so they don’t wait without knowing what’s happening.

Error notification can be implemented in the JS widget using the APP.notifications class. Showing the notification is performed using the show_message_error() feature, and errors are registered using add_error() feature.

The notification will appear in the interface, and will be transmitted over all active delivery channels, which means it will appear in the notification center (the bell icon).

Example of an error message

foto

Example on how to show notification about an error

var  errors = APP.notifications,
date_now = Date.now(),
header= this.langs.widget.name,	
text = 'an error happened'
var n_data = {
    header: header, //Error from which integration
    text:''+text+'',//Error notification text
    date: date_now //date
},
callbacks = { 
done: function(){console.log('done');}, //successfully added and saved AJAX done
     fail: function(){console.log('fail');}, //AJAX fail
     always: function(){console.log('always');} //it always  requests
 };
errors.add_error(n_data,callbacks);
APP.notifications.show_message_error(n_data, callbacks); //Show notification error.

You can also provide a simple notification whenever you want using the notification about an error method. When using this method, the notification will be displayed only in the interface and will not be transferred or appear in the notification center.

Example of the error notification

foto

Example on how to show this notification

var notification = {
  text: {
    header: "Error",
    text: "Error happened during call"
  },
  type: "error"
};
APP.notifications.show_notification(notification);