Don't hard code base URL prefix

This commit is contained in:
Nicolò P 2023-10-13 17:28:16 +02:00
parent 73cc9485f8
commit 24317a9eb2
4 changed files with 6 additions and 9 deletions

View File

@ -11,10 +11,7 @@ class Canvas {
name = '';
images = [];
thumbnail = {};
/**
*
* @param {string} label
*/
constructor(IIIFApiVersion, baseURL) {
this.context = `https://iiif.io/api/presentation/${IIIFApiVersion}/context.json`;
this.BASE_URL = baseURL;
@ -24,7 +21,7 @@ class Canvas {
* @param {int|string} name A unique name for this canvas
*/
generateID(resourceId, name) {
this.id = `${this.BASE_URL}/iiif/${resourceId}/canvas/${name}`;
this.id = `${this.BASE_URL}/${resourceId}/canvas/${name}`;
this.resourceId = resourceId;
this.name = name;
}

View File

@ -47,8 +47,8 @@ class Image {
this.service['@id'] = this.id.replace(/\/full.*$/,'');
}
/**
* Object representation of
* image resource
* Object representation of this image
*
* @returns {Object}
*/
toObject() {

View File

@ -26,7 +26,7 @@ class Manifest {
* @param {string} resourceId From the request
*/
generateID(resourceId) {
this.id = `${this.BASE_URL}/iiif/${resourceId}/manifest` ;
this.id = `${this.BASE_URL}/${resourceId}/manifest` ;
this.resourceId = resourceId;
}
/**

View File

@ -19,7 +19,7 @@ class Sequence {
* @param {int|string} name A unique name for this sequence
*/
generateID(resourceId, name) {
this.id = `${this.BASE_URL}/iiif/${resourceId}/sequence/${name}`;
this.id = `${this.BASE_URL}/${resourceId}/sequence/${name}`;
this.resourceId = resourceId;
}
/**