summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src/reducers/file.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core/src/reducers/file.js')
-rw-r--r--packages/gitbook-core/src/reducers/file.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/gitbook-core/src/reducers/file.js b/packages/gitbook-core/src/reducers/file.js
new file mode 100644
index 0000000..82b0f42
--- /dev/null
+++ b/packages/gitbook-core/src/reducers/file.js
@@ -0,0 +1,16 @@
+const ACTION_TYPES = require('../actions/TYPES');
+const File = require('../models/File');
+
+module.exports = (state, action) => {
+ state = File.create(state);
+
+ switch (action.type) {
+
+ case ACTION_TYPES.PAGE_FETCH_END:
+ return state.merge(action.payload.file);
+
+ default:
+ return state;
+
+ }
+};