1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-25 08:09:43 +02:00

Default to empty array results in Ember services

This commit is contained in:
McMatts 2018-03-23 11:50:21 +00:00
parent 38e8c4665a
commit 8d65c2d571
10 changed files with 36 additions and 11 deletions

View file

@ -24,6 +24,7 @@ export default BaseService.extend({
method: 'GET'
}).then((response) => {
let data = [];
if (is.not.array(response)) response = [];
data = response.map((obj) => {
let data = this.get('store').normalize('section', obj);
@ -55,6 +56,7 @@ export default BaseService.extend({
method: 'GET'
}).then((response) => {
let pages = [];
if (is.not.array(response)) response = [];
if (is.not.null(response) && is.array(response) && response.length > 0) {
pages = response.map((page) => {
@ -103,6 +105,7 @@ export default BaseService.extend({
method: 'GET'
}).then((response) => {
let data = [];
if (is.not.array(response)) response = [];
data = response.map((obj) => {
let data = this.get('store').normalize('block', obj);