@abi-software/flatmap-viewer 2.3.0-a.2 → 2.3.0-a.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.rst CHANGED
@@ -38,7 +38,7 @@ The map server endpoint is specified as ``MAP_ENDPOINT`` in ``src/main.js``. It
38
38
  Package Installation
39
39
  ====================
40
40
 
41
- * ``npm install @abi-software/flatmap-viewer@2.3.0-a.2``
41
+ * ``npm install @abi-software/flatmap-viewer@2.3.0-a.4``
42
42
 
43
43
  Documentation
44
44
  -------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmap-viewer",
3
- "version": "2.3.0-a.2",
3
+ "version": "2.3.0-a.4",
4
4
  "description": "Flatmap viewer using Maplibre GL",
5
5
  "repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
6
6
  "main": "src/main.js",
@@ -18,6 +18,7 @@
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.10.4",
21
+ "@fortawesome/fontawesome-free": "^6.4.0",
21
22
  "@turf/area": "^6.0.1",
22
23
  "@turf/bbox": "^6.0.1",
23
24
  "@turf/helpers": "^6.1.4",
package/src/annotation.js CHANGED
@@ -23,7 +23,7 @@ limitations under the License.
23
23
  //==============================================================================
24
24
 
25
25
  // We use Font Awesome icons
26
- import '../static/css/font-awesome.min.css';
26
+ import '@fortawesome/fontawesome-free/css/all.css';
27
27
  import escape from 'html-es6cape';
28
28
  import { jsPanel } from 'jspanel4';
29
29
  import 'jspanel4/dist/jspanel.css';
@@ -113,17 +113,18 @@ export class Annotator
113
113
  }).then((response) => {
114
114
  panel.headerlogo.innerHTML = '';
115
115
  if (response.ok) {
116
- const creator = response.json();
117
- if ('error' in creator) {
118
- callback({error: creator.error});
119
- } else {
120
- this.__setUser(creator);
121
- this.__authorised = true;
122
- callback(creator);
123
- }
116
+ return response.json();
124
117
  } else {
125
118
  callback({error: `${response.status} ${response.statusText}`});
126
119
  }
120
+ }).then((response) => {
121
+ if ('error' in response) {
122
+ callback({error: response.error});
123
+ } else {
124
+ this.__setUser(response);
125
+ this.__authorised = true;
126
+ callback(response);
127
+ }
127
128
  });
128
129
  setTimeout((panel) => {
129
130
  if (this.user === 'undefined') {
@@ -148,10 +149,12 @@ export class Annotator
148
149
  }).then((response) => {
149
150
  if (response.ok) {
150
151
  this.__authorised = false;
151
- console.log('Annotator logout:', response.json());
152
+ return response.json();
152
153
  } else {
153
154
  console.log('Annotator logout:', `${response.status} ${response.statusText}`);
154
155
  }
156
+ }).then((response) => {
157
+ console.log('Annotator logout:', response);
155
158
  });
156
159
  setTimeout(() => {
157
160
  if (this.__authorised) {
@@ -293,10 +296,12 @@ export class Annotator
293
296
  signal: abortController.signal
294
297
  }).then((response) => {
295
298
  if (response.ok) {
296
- callback(response.json());
299
+ return response.json();
297
300
  } else {
298
301
  callback({error: `${response.status} ${response.statusText}`});
299
302
  }
303
+ }).then((response) => {
304
+ callback(response);
300
305
  });
301
306
  return abortController;
302
307
  }