diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-14 15:17:15 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-14 15:17:15 -0300 |
commit | e97c808b412167d334353c7f6370e6d8b70bc0ae (patch) | |
tree | a0cfe2add2f6b369c858b81a01a20621fd79dc5b /packages/web-util/src/serve.ts | |
parent | ae2df08abd2da47c3b409d4f61d746825daa500d (diff) | |
download | wallet-core-e97c808b412167d334353c7f6370e6d8b70bc0ae.tar.xz |
moving testing sdk to web-utils
Diffstat (limited to 'packages/web-util/src/serve.ts')
-rw-r--r-- | packages/web-util/src/serve.ts | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/packages/web-util/src/serve.ts b/packages/web-util/src/serve.ts index 3248bbeb8..f3a97e2e2 100644 --- a/packages/web-util/src/serve.ts +++ b/packages/web-util/src/serve.ts @@ -77,23 +77,26 @@ export async function serve(opts: { if (opts.onUpdate) { sendToAllClients({ type: "file-updated-start", data: { path } }); - opts.onUpdate().then((result) => { - sendToAllClients({ - type: "file-updated-done", - data: { path, result }, + opts + .onUpdate() + .then((result) => { + sendToAllClients({ + type: "file-updated-done", + data: { path, result }, + }); + }) + .catch((error) => { + sendToAllClients({ + type: "file-updated-failed", + data: { path, error }, + }); }); - }).catch((error) => { - sendToAllClients({ - type: "file-updated-failed", - data: { path, error }, - }); - }); } else { sendToAllClients({ type: "file-change", data: { path } }); } }); - if (opts.onUpdate) opts.onUpdate() + if (opts.onUpdate) opts.onUpdate(); app.get(PATHS.EXAMPLE, function (req: any, res: any) { res.set("Content-Type", "text/html"); |