Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Flux action with login
var client = require("shared/client");
module.exports = function(context, payload, done) {
if (payload.login === undefined) {
throw new Error("Login must be defined");
if (payload.password === undefined) {
throw new Error("Password must be defined");
var login = payload.login;
var password = payload.password;
client.login(login, password, function(err, res) {
if (err !== undefined) {
context.dispatch("event:LoginFailed", err);
} else {
context.dispatch("event:LoginSucceeded", res);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment