Skip to content

Commit df24847

Browse files
committed
getJson/postJson: use fetchWithErrors
1 parent 9478998 commit df24847

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/util/xhrPromise.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { fetchWithErrors } from './fetchUtils';
2+
13
function serialize(obj, prefix) {
24
if (!obj) {
35
return '';
@@ -17,7 +19,7 @@ function serialize(obj, prefix) {
1719

1820
// Return Promise for a url json get request
1921
export function getJson(url, params) {
20-
return fetch(
22+
return fetchWithErrors(
2123
encodeURI(url) +
2224
(params ? (url.search(/\?/) === -1 ? '?' : '&') + serialize(params) : ''),
2325
{
@@ -33,7 +35,7 @@ export function getJson(url, params) {
3335

3436
// Return Promise for a json post request
3537
export function postJson(url, params, payload) {
36-
return fetch(
38+
return fetchWithErrors(
3739
encodeURI(url) +
3840
(params ? (url.search(/\?/) === -1 ? '?' : '&') + serialize(params) : ''),
3941
{

0 commit comments

Comments
 (0)