Skip to content

Commit cda05cf

Browse files
committed
Improve client-side code
1 parent 274c7f6 commit cda05cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

JavaScript/1-HTTP/static/client.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const buildAPI = methods => {
55
for (const method of methods) {
66
api[method] = (...args) => new Promise((resolve, reject) => {
77
const url = `/api/${method}`;
8-
console.log(url);
8+
console.log(url, args);
99
fetch(url, {
1010
method: 'POST',
1111
headers: { 'Content-Type': 'application/json' },
@@ -34,8 +34,9 @@ const scenario = async () => {
3434
await api.move('Rect1', 5, 5);
3535
await api.rotate('Rect1', 5);
3636
const data = await api.read('Rect1');
37+
console.dir({ data })
3738
await show();
3839
};
3940

40-
const api = buildAPI(['rect', 'move', 'rotate', 'read', 'render']);
41+
const api = buildAPI(['rect', 'move', 'rotate', 'read', 'render', 'resize']);
4142
scenario();

0 commit comments

Comments
 (0)