diff options
| author | Sean Fridman <fridman@mail.sfsu.edu> | 2015-04-15 14:15:01 -0400 |
|---|---|---|
| committer | Sean Fridman <fridman@mail.sfsu.edu> | 2015-04-15 14:15:01 -0400 |
| commit | 44c6aa932ea4e665836d7a7ae874fd0d2ec74099 (patch) | |
| tree | b46318fe2b8425f1741a9eea358955f63fe26288 /app/index.js | |
| parent | 1ddb94a736d5178a933ef5366a6088469a601997 (diff) | |
Allow views without queries
Diffstat (limited to 'app/index.js')
| -rw-r--r-- | app/index.js | 6 |
1 files changed, 3 insertions, 3 deletions
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) { |
