From 44c6aa932ea4e665836d7a7ae874fd0d2ec74099 Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Wed, 15 Apr 2015 14:15:01 -0400 Subject: Allow views without queries --- app/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/index.js') diff --git a/app/index.js b/app/index.js index 7860f76..5f50cec 100644 --- a/app/index.js +++ b/app/index.js @@ -168,8 +168,7 @@ OKCMS.prototype._createViews = function(viewConfig, db, if (!template) { throw new Error(format('No template named "%s" found', templateName)); } - var queryConfig = config.data || []; - var queries = createQueries(queryConfig, resourceCache); + var queries = createQueries(config.data, resourceCache); // Don't forget to add that trailing slash if the user forgot cache[withTrailingSlash(route)] = OKView({ mount: 'get', // User defined views are read only @@ -231,7 +230,8 @@ OKCMS.prototype._createAdminViews = function(path, app, express, }; OKCMS.prototype._createQueries = function(queryConfig, resourceCache) { - queryConfig = queryConfig || {}; + if (!queryConfig) + return []; if (!queryConfig.length) queryConfig = [queryConfig]; return queryConfig.map(function(config) { -- cgit v1.2.3-70-g09d2