Last active
November 2, 2018 10:33
-
-
Save LayZeeDK/6d7a662801b25bd392823aa7b82496ec to your computer and use it in GitHub Desktop.
TypeScript: Todo item
This file contains hidden or 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
class TodoItem { | |
id: string; | |
isDone: boolean; | |
title: string; | |
save(): Promise<void> { | |
return fetch("/todo/" + this.id, { | |
body: JSON.stringify(this), | |
method: "POST", | |
}) | |
.then(() => undefined); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment