Last active
July 25, 2018 08:27
-
-
Save mattwagl/b5fa022ad3a9ed788e3a68a138111f7e to your computer and use it in GitHub Desktop.
Simple wolkenkit writeModel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = { | |
title: undefined, | |
slug: undefined | |
}; | |
const commands = { | |
mount (board, command) { | |
if (command.data.title === undefined) { | |
command.reject('Title is missing.'); | |
return; | |
} | |
board.events.publish('mounted', { | |
title: command.data.title, | |
slug: slugify(command.data.title) | |
}); | |
} | |
}; | |
const events = { | |
mounted (board, command) { | |
board.setState({ | |
title: command.data.title, | |
slug: command.data.slug | |
}) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment