mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 14:43:09 +02:00
Refactoring
This commit is contained in:
parent
cdf65aedcb
commit
0df093383d
1 changed files with 6 additions and 11 deletions
|
@ -20,18 +20,13 @@ export default (user: ILocalUser, url: string, object: any) => new Promise((reso
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
path: pathname + search,
|
path: pathname + search,
|
||||||
}, res => {
|
}, res => {
|
||||||
res.on('end', () => {
|
log(`${url} --> ${res.statusCode}`);
|
||||||
log(`${url} --> ${res.statusCode}`);
|
|
||||||
|
|
||||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
if (res.statusCode >= 400) {
|
||||||
resolve();
|
reject();
|
||||||
} else {
|
} else {
|
||||||
reject(res);
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
res.on('data', () => {});
|
|
||||||
res.on('error', reject);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sign(req, {
|
sign(req, {
|
||||||
|
|
Loading…
Reference in a new issue