Check if the errors array exists before referencing it

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2018-01-09 17:37:09 -05:00
parent a98ae57318
commit 502c73d3f2
+1 -1
View File
@@ -144,7 +144,7 @@ export const api = {
return data.json();
},
checkForErrors(data) {
if(data.errors.length > 0) {
if(!data.errors || data.errors.length > 0) {
return Promise.reject(data.errors);
}
return Promise.resolve(data.data);