corejavascript / corejavascript/typeahead.js

Expose XHR - Intercept remote calls.

Open
#46 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
968
Forks
231
PR merge metrics
No merged PRs in 30d

Description

It seems like this plugin is locked down. Its a shame that twitter didn't allow for customisation.

I am now finding very difficult to intercept the XHR request. The typeahead sometimes responds with 401 if your session has timed out. I would like to intercept it and return the user to the login screen.

I have tried:

```
$(document).ajaxComplete(function(event, xhr) {
if(xhr.status == 401){
window.location.reload();
}
});

.bind('typeahead:asyncreceive', function(event , a ,b){
//none of these vars are useful. - event object doesn't seem to contain the XHR

});
```

I have also tried numerous settings in bloodhound / typeahead, but these appear to have been phased out:
https://github.com/twitter/typeahead.js/issues/1029
http://stackoverflow.com/questions/23985898/twitter-typeahead-bloodhound-reutilization-how-do-i-show-a-loading-gif-for-th

Starting to wish I picked a different library :/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.