nl_tokens: Make a request to the REST API .
pl_tokens: function ( opts ) { opts = opts || { } ; const defaults = { // the default 'method' is 'GET', as set by 'jquery.ajax' girderToken : getCurrentToken ( ) || cookie . find ( 'girderToken' ) , error : ( error , status ) => { let <mask> ; if ( error . status === 401 ) { events . trigger ( 'g:loginUi' ) ; info = { text : 'You must log in to view this resource' , type : 'warning' , timeout : 4000 , icon : 'info' } ; } else if ( error . status === 403 ) { info = { text : 'Access denied. See the console for more details.' , type : 'danger' , timeout : 5000 , icon : 'attention' } ; } else if ( error . status === 0 && error . statusText === 'abort' ) { /* We expected this abort, so do nothing. */ return ; } else if ( error . status === 500 && error . responseJSON && error . responseJSON . type === 'girder' ) { info = { text : error . responseJSON . message , type : 'warning' , timeout : 5000 , icon : 'info' } ; } else if ( status === 'parsererror' ) { info = { text : 'A parser error occurred while communicating with the ' + 'server (did you use the correct value for `dataType`?). ' + 'Details have been logged in the console.' , type : 'danger' , timeout : 5000 , icon : 'attention' } ; } else { info = { text : 'An error occurred while communicating with the ' + 'server. Details have been logged in the console.' , type : 'danger' , timeout : 5000 , icon : 'attention' } ; } events . trigger ( 'g:alert' , info ) ; console . error ( error . status + ' ' + error . statusText , error . responseText ) ; } } ; // Overwrite defaults with passed opts, but do not mutate opts const args = _ . extend ( { } , defaults , opts ) ; if ( ! args . url ) { throw new Error ( 'restRequest requires a "url" argument' ) ; } args . url = ` ${ getApiRoot ( ) } ${ args . url . substring ( 0 , 1 ) === '/' ? '' : '/' } ${ args . url } ` ; if ( args . girderToken ) { args . headers = args . headers || { } ; args . headers [ 'Girder-Token' ] = args . girderToken ; delete args . girderToken ; } return Backbone . $ . ajax ( args ) ; }