Last active
August 29, 2015 14:11
-
-
Save stephen/a7a89b5e4c6b8dd1116f to your computer and use it in GitHub Desktop.
This file contains 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
static load(token) { | |
return new Promise((resolve, reject) => { | |
this._createQuery().get(token).then((data) => { | |
resolve(new this(data)); | |
}, (err) => { | |
if (err.code === 101) { | |
resolve(null); // model with token does not exist. | |
} else { | |
reject(new Error(err)); | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment