You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 12, 2020. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+13-2
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ When an app communicates with a HTTP API, which enforces some form of authentica
12
12
13
13
With the work flow defined above we'll start with the Reflux _action creators_ and _reducers_.
14
14
15
+
## Action Creators ##
15
16
16
17
In _step 2_ the user taps the submit button, which dispatches the `login(username, password)` function.
17
18
@@ -21,10 +22,14 @@ In _step 2_ the user taps the submit button, which dispatches the `login(usernam
21
22
export function login(username, password) {
22
23
return (dispatch) => {
23
24
24
-
/* We use this to update the state of `isLoggingIn` to `true` in our store, which can be used to display an activity indicator on the login view. */
25
+
// We use this to update the state of `isLoggingIn` to `true` in our
26
+
// store, which can be used to display an activity indicator on the login
27
+
// view.
25
28
dispatch(loginRequest())
26
29
27
-
/* This only works in Node, use an implementation that work for the platform you're using, e.g.: `base64-js` for React Native, or `btoa()`` for browsers. */
30
+
// This only works in Node, use an implementation that work for the
31
+
// platform you're using, e.g.: `base64-js` for React Native, or `btoa()`
32
+
// for browsers, etc...
28
33
const hash = new Buffer(`${username}:${password}`).toString('base64')
@@ -48,3 +53,9 @@ export function login(username, password) {
48
53
}
49
54
}
50
55
```
56
+
57
+
The above function dispatches 3 other actions: `LOGIN_REQUEST`, `LOGIN_FAILURE`, `LOGIN_SUCCESS`. (They're fairly generic, and not really worth documenting - Check `actions/user.js` for their implementation.)
0 commit comments