Switched out the backend server url. Also ensured that the backendservice won't make the same query twice which is a challenge with people double clicking to select a word.
This commit is contained in:
parent
6c1a8891e3
commit
8004eea37d
4 changed files with 23 additions and 12 deletions
|
@ -8,7 +8,8 @@ module tagIt {
|
|||
}
|
||||
|
||||
export class AppConfigService {
|
||||
serverUrl = 'http://lexitags.dyndns.org/server/lexitags2/Semtags?data=';
|
||||
// serverUrl = 'http://lexitags.dyndns.org/server/lexitags2/Semtags?data=';
|
||||
serverUrl = 'https://imdb.uib.no/lexitags/lexitags/';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ module tagIt {
|
|||
this.tagStorageService = TagStorageService;
|
||||
|
||||
this.$scope.$on('wordWasSelected', (event, selectedWord) => {
|
||||
this.$log.debug('a word was selected' + selectedWord);
|
||||
this.$log.debug(`Menucontroller received wordWasSelected event for: ${selectedWord}`);
|
||||
this.onWordSelectedEvent(selectedWord);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "Tag you're it",
|
||||
"description": "A browser tool for tagging words with exact definitions.",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6",
|
||||
"manifest_version": 2,
|
||||
"icons": {
|
||||
"16": "icon16.png",
|
||||
|
@ -11,7 +11,7 @@
|
|||
"permissions": [
|
||||
"storage",
|
||||
"activeTab",
|
||||
"http://lexitags.dyndns.org/"
|
||||
"https://imdb.uib.no/"
|
||||
],
|
||||
"background": {
|
||||
"persistent": false,
|
||||
|
|
|
@ -3,26 +3,40 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Service that is responsible for talking to the
|
||||
* backend server.
|
||||
*/
|
||||
module tagIt {
|
||||
|
||||
export class BackendService {
|
||||
|
||||
$http : ng.IHttpService;
|
||||
$log : ng.ILogService;
|
||||
$q: ng.IQService;
|
||||
private serverUrl : string = null;
|
||||
private previousCall: string;
|
||||
|
||||
/* @ngInject */
|
||||
constructor($http: ng.IHttpService, $log: ng.ILogService, AppConfigService: AppConfigService) {
|
||||
constructor($http: ng.IHttpService, $q: ng.IQService, $log: ng.ILogService, AppConfigService: AppConfigService) {
|
||||
this.$http = $http;
|
||||
this.$log = $log;
|
||||
this.$q = $q;
|
||||
this.serverUrl = AppConfigService.serverUrl;
|
||||
}
|
||||
|
||||
callServer (word: string) {
|
||||
if (!word) {
|
||||
return;
|
||||
};
|
||||
return this.$http.get(this.serverUrl + this.createQuery(word));
|
||||
return this.$q.reject('no use calling server, there is no queryword.')
|
||||
} else if (this.previousCall === word) {
|
||||
var errMsg = `callServer has already been called with word: ${word}`;
|
||||
this.$log.debug(errMsg)
|
||||
return this.$q.reject(errMsg);
|
||||
}
|
||||
|
||||
//alright let's make this query!
|
||||
this.previousCall = word;
|
||||
return this.$http.get(this.serverUrl + word);
|
||||
}
|
||||
|
||||
sendTaggedDataToServer (senseTag: ISenseTag) {
|
||||
|
@ -43,9 +57,5 @@ module tagIt {
|
|||
// });
|
||||
}
|
||||
|
||||
private createQuery (word: string) {
|
||||
return '{"word":"QUERYTOREPLACE"}'
|
||||
.replace(/QUERYTOREPLACE/, word);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue