forked from p34709852/monkey
Island UI: fix a bug in IslandHttpClient.tsx that caused the body of a Response object to be a promise instead of an object
This commit is contained in:
parent
5743f8ea98
commit
980f06ed73
|
@ -13,18 +13,22 @@ export class Response{
|
|||
|
||||
class IslandHttpClient extends AuthComponent {
|
||||
post(endpoint: string, contents: any): Promise<Response>{
|
||||
let status = null;
|
||||
return this.authFetch(endpoint,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify(contents)
|
||||
})
|
||||
.then(res => new Response(res.json(), res.status));
|
||||
.then(res => {status = res.status; return res.json()})
|
||||
.then(res => new Response(res, status));
|
||||
}
|
||||
|
||||
get(endpoint: string): Promise<Response>{
|
||||
let status = null;
|
||||
return this.authFetch(endpoint)
|
||||
.then(res => new Response(res.json(), res.status));
|
||||
.then(res => {status = res.status; return res.json()})
|
||||
.then(res => new Response(res, status));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue