diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-08 22:11:55 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-08 22:11:55 +0100 |
| commit | d2cb17038b8537a609be06be2ed7013dbe27117e (patch) | |
| tree | 028ceac9edddafc03ce80c49d5a05981bec3fcbe /animism-align/frontend/app/views/editor/editor.gate.js | |
| parent | b5ceb782f40fc1e402d1e58bc1ced2e4038fd787 (diff) | |
beginning the BIG refactor. moving editor stuff into per-episode hierarchy
Diffstat (limited to 'animism-align/frontend/app/views/editor/editor.gate.js')
| -rw-r--r-- | animism-align/frontend/app/views/editor/editor.gate.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/animism-align/frontend/app/views/editor/editor.gate.js b/animism-align/frontend/app/views/editor/editor.gate.js new file mode 100644 index 0000000..968680f --- /dev/null +++ b/animism-align/frontend/app/views/editor/editor.gate.js @@ -0,0 +1,32 @@ +import React, { Component } from 'react' + +import { Loader } from 'app/common' + +import actions from 'app/actions' + +export default class EditorGate extends Component { + constructor(props) { + super(props) + this.load() + } + + componentDidUpdate(prevProps) { + if (this.props.episode_id !== prevProps.episode_id) { + this.load() + } + } + + load() { + this.props.episode_id && actions.site.loadEpisode() + } + + render() { + if (this.props.logged_in) { + return this.props.children + } + return ( + <Loader /> + ) + } +} + |
