Skip to content

Commit f950b6b

Browse files
committed
Change an example to use .then()
1 parent d2c96af commit f950b6b

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

examples.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@ async function examples() {
2222
console.log(e);
2323
}
2424

25-
try {
26-
const listServersByConnection = await api.listServersByConnection({ connection_id: '1' });
27-
console.log(listServersByConnection);
28-
// {
29-
// success: true,
30-
// errors: [],
31-
// data: { Servers: { '1': 'test', '2': 'Minecraft Server' } }
32-
// }
33-
} catch (e) {
34-
console.log(e);
35-
}
25+
api.listServersByConnection({ connection_id: '1' })
26+
.then((data) => console.log(data))
27+
.catch((err) => console.error(err));
28+
// {
29+
// success: true,
30+
// errors: [],
31+
// data: { Servers: { '1': 'test', '2': 'Minecraft Server' } }
32+
// }
3633
}
3734

3835
examples()

0 commit comments

Comments
 (0)