@@ -21,7 +21,7 @@ const getImage = (
21
21
}
22
22
23
23
if ( returns === 'json' ) {
24
- requestQuery [ ' headers' ] = {
24
+ requestQuery . headers = {
25
25
Accept : 'application/json'
26
26
}
27
27
}
@@ -30,15 +30,15 @@ const getImage = (
30
30
if ( [ 'default' , 'thumbnail' , 'mobile' ] . includes ( size ) ) {
31
31
requestQuery [ 'url' ] += `/image/${ size } `
32
32
} else {
33
- throw `Image size doesn't exists`
33
+ throw new Error ( `Image size doesn't exists` )
34
34
}
35
35
}
36
36
37
37
if ( backgroundSize !== undefined ) {
38
38
if ( [ 'default' , 'thumbnail' , 'mobile' , 'tablet' ] . includes ( backgroundSize ) ) {
39
39
requestQuery [ 'url' ] += `/background/${ backgroundSize } `
40
40
} else {
41
- throw `Image background size doesn't exists`
41
+ throw new Error ( `Image background size doesn't exists` )
42
42
}
43
43
}
44
44
@@ -54,21 +54,21 @@ const getImage = (
54
54
if ( choiceImageSizes . includes ( choiceSize ) ) {
55
55
requestQuery [ 'url' ] += `/choice/${ choiceSize } `
56
56
} else {
57
- throw `Image choice size doesn't exists`
57
+ throw new Error ( `Image choice size doesn't exists` )
58
58
}
59
59
}
60
60
61
61
return http . request ( requestQuery )
62
62
}
63
63
64
- const addImage = ( http , { image, media_type , file_name } ) => {
64
+ const addImage = ( http , { image, mediaType , fileName } ) => {
65
65
return http . request ( {
66
66
method : 'post' ,
67
67
url : `/images` ,
68
68
data : {
69
69
image,
70
- file_name,
71
- media_type
70
+ file_name : fileName ,
71
+ media_type : mediaType
72
72
}
73
73
} )
74
74
}
0 commit comments