diff --git a/app/views/shelves/controller.js b/app/views/shelves/controller.js
index 35078be..cc112d6 100644
--- a/app/views/shelves/controller.js
+++ b/app/views/shelves/controller.js
@@ -7,25 +7,7 @@ export class ShelvesController extends ViewController {
super(state, i18n, 'shelves', {
openModal: null, // state value for edit modals
myShelves: [], // array of objects in sort order with name, id, and deletability.
- loadedShelves: { // object key is shelf id with name and shelfItems
- 0: {
- name: 'Test Shelf',
- user: {
- userName: 'testinTesterton',
- displayName: 'Testin Testerton',
- },
- shelfItems: [
- {
- name: 'Book Title',
- author: 'Someone Talented',
- coverURL: 'https://picnicss.com/web/img/optimised.svg',
- coverEdition: 'Special Edition',
- rating: 4,
- review: 'The Special Edition of Book Title by Someone Talented is my favorite thing in the whole world. I think and dream about it constantly and there is nothing better in the whole world.',
- }
- ]
- },
- },
+ loadedShelves: {}, // object key is shelf id with name and shelfItems
});
// If using controller methods in an input's onchange or onclick instance,
@@ -44,6 +26,10 @@ export class ShelvesController extends ViewController {
return typeof this.appState.query.shelf !== 'undefined' ? parseInt(this.appState.query.shelf) : null;
}
+ get targetDomain () {
+ return typeof this.appState.query.domain !== 'undefined' ? parseInt(this.appState.query.domain) : null;
+ }
+
getUserShelves () {
return fetch('/api/shelves/get').then(response => response.json()).then(shelves => {
this.state.myShelves = shelves;
@@ -51,7 +37,8 @@ export class ShelvesController extends ViewController {
}
getTargetShelf () {
- return fetch('/api/shelf/get/' + this.targetShelf).then(response => response.json()).then(shelf => {
+ const target = this.targetShelf + (this.targetDomain !== null ? `/${this.targetDomain}` : '');
+ return fetch('/api/shelf/get/' + target).then(response => response.json()).then(shelf => {
this.state.loadedShelves[this.targetShelf] = shelf;
});
}
diff --git a/app/views/shelves/shelf.js b/app/views/shelves/shelf.js
index 4ee1be4..1214fac 100644
--- a/app/views/shelves/shelf.js
+++ b/app/views/shelves/shelf.js
@@ -45,6 +45,19 @@ export const shelfView = (shelvesController, emit) => {
];
}
+ if (typeof shelf.error !== 'undefined') {
+ return [
+ html`
+ ${__('global.error')}
+
+
+
+ `,
+ ];
+ }
+
const shelfItems = shelf !== null ? shelf.shelfItems : [];
// Returning an array in a view allows non-shared parent HTML elements.
@@ -54,7 +67,7 @@ export const shelfView = (shelvesController, emit) => {