Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: 2-7-serve/web/piratebadge.dart

Issue 1056193003: Rename methods to better match new terminology and get rid of json data file. (Closed) Base URL: https://github.com/dart-lang/one-hour-codelab.git@server2
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « 2-7-serve/lib/server/piratesapi.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: 2-7-serve/web/piratebadge.dart
diff --git a/2-7-serve/web/piratebadge.dart b/2-7-serve/web/piratebadge.dart
index e637ad051cb2cc867a29d206cd0fa51cf8f32106..9a47f2487475a5e7be04c54263eab2aa011cf8b2 100644
--- a/2-7-serve/web/piratebadge.dart
+++ b/2-7-serve/web/piratebadge.dart
@@ -99,7 +99,7 @@ Future storeBadge(Event e) async {
if (pirateName == null || pirateName.isEmpty) return null;
var pirate = new Pirate.fromString(pirateName);
try {
- await _api.addPirate(pirate);
+ await _api.hirePirate(pirate);
} catch (error) {
window.alert(error.message);
}
@@ -121,7 +121,7 @@ Future removeBadge(Event e) async {
var option = pirateList.options.elementAt(idx);
var pirate = new Pirate.fromString(option.label);
try {
- await _api.killPirate(pirate.name, pirate.appellation);
+ await _api.firePirate(pirate.name, pirate.appellation);
} catch (error) {
window.alert(error.message);
}
@@ -135,7 +135,7 @@ Future removeAllBadges(Event e) async {
for (var option in pirateList.options) {
var pirate = new Pirate.fromString(option.label);
try {
- await _api.killPirate(pirate.name, pirate.appellation);
+ await _api.firePirate(pirate.name, pirate.appellation);
} catch (error) {
// ignoring errors.
}
@@ -159,7 +159,7 @@ void setBadgeName(Pirate pirate) {
return;
}
badgeNameElement.text = pirate.toString();
- window.localStorage[TREASURE_KEY] = pirate.jsonString;
+ window.localStorage[TREASURE_KEY] = pirate.toString();
storeButton
..disabled = false
..text = 'Hire pirate!';
@@ -168,7 +168,7 @@ void setBadgeName(Pirate pirate) {
Pirate getBadgeNameFromStorage() {
String storedName = window.localStorage[TREASURE_KEY];
if (storedName != null) {
- return new Pirate.fromJSON(storedName);
+ return new Pirate.fromString(storedName);
} else {
return null;
}
« no previous file with comments | « 2-7-serve/lib/server/piratesapi.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698