Commit 0e797219 authored by gulhe's avatar gulhe Committed by Hanzei
Browse files

[Documentation] simplified the "Promise" example (#784)

#### Summary
If someone were to use promise, it would be clearer to write their code this way, doing so they would take advantage of the promises.

#### Ticket Link
There is no ticket for that tell me if I need to create one (in which case I will strongly reconsider contributing this piece of doc since it would mean creating an account on a third party site and all ...)

#### Test Information
This PR was not tested at all. The mentionned code was tested in a console on chrome 
parent c5764901
......@@ -64,23 +64,11 @@ import {Client4} from 'mattermost-redux/client';
Client4.setUrl('https://your-mattermost-url.com');
function loginAndGetUser(username, password, callback) {
Client4.login(username, password).then(
() => {
Client4.getMe().then(
(data) => {
callback(data);
}
).catch(
(error) => {
console.error(error);
}
);
}
).catch(
(error) => {
console.error(error);
}
);
Client4
.login(username, password)
.then(Client4.getMe)
.then(callback)
.catch(console.error);
}
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment