Skip to content

Instantly share code, notes, and snippets.

@TheIronDev
Created July 6, 2015 20:25
Show Gist options
  • Save TheIronDev/9a2466890e6b0836d395 to your computer and use it in GitHub Desktop.
Save TheIronDev/9a2466890e6b0836d395 to your computer and use it in GitHub Desktop.
@@ -61,6 +61,9 @@ module.exports = React.createClass({
},
getInitialState() {
+
+ let previousTransactions = localStorage.previousTransactions ? JSON.parse(localStorage.previousTransactions) : [];
+
return {
// Server-Side calls will populate these
@@ -69,7 +72,7 @@ module.exports = React.createClass({
// Not sure how we will fill these out yet
amounts: mockAmount,
- previousTransactions: mockTransactions,
+ previousTransactions: previousTransactions,
// UI related classes
recipientStatus: '',
@@ -220,6 +223,10 @@ module.exports = React.createClass({
showSuccess: true
});
+ let previousTransactions = this.state.previousTransactions || [];
+ previousTransactions.push(mockTransactions[0]);
+ localStorage.setItem('previousTransactions', JSON.stringify(previousTransactions));
+
if (callback) {
callback(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment