@@ -4,14 +4,14 @@ export default http => ({
44 add : args => addImage ( http , args ) ,
55 delete : args => deleteImage ( http , args )
66} )
7- export const getImages = http => {
7+ const getImages = http => {
88 return http . request ( {
99 method : 'get' ,
1010 url : '/images'
1111 } )
1212}
1313
14- export const getImage = (
14+ const getImage = (
1515 http ,
1616 { id, returns, size, backgroundSize, choiceSize }
1717) => {
@@ -21,7 +21,7 @@ export const getImage = (
2121 }
2222
2323 if ( returns === 'json' ) {
24- requestQuery [ ' headers' ] = {
24+ requestQuery . headers = {
2525 Accept : 'application/json'
2626 }
2727 }
@@ -30,15 +30,15 @@ export const getImage = (
3030 if ( [ 'default' , 'thumbnail' , 'mobile' ] . includes ( size ) ) {
3131 requestQuery [ 'url' ] += `/image/${ size } `
3232 } else {
33- throw `Image size doesn't exists`
33+ throw new Error ( `Image size doesn't exists` )
3434 }
3535 }
3636
3737 if ( backgroundSize !== undefined ) {
3838 if ( [ 'default' , 'thumbnail' , 'mobile' , 'tablet' ] . includes ( backgroundSize ) ) {
3939 requestQuery [ 'url' ] += `/background/${ backgroundSize } `
4040 } else {
41- throw `Image background size doesn't exists`
41+ throw new Error ( `Image background size doesn't exists` )
4242 }
4343 }
4444
@@ -54,26 +54,26 @@ export const getImage = (
5454 if ( choiceImageSizes . includes ( choiceSize ) ) {
5555 requestQuery [ 'url' ] += `/choice/${ choiceSize } `
5656 } else {
57- throw `Image choice size doesn't exists`
57+ throw new Error ( `Image choice size doesn't exists` )
5858 }
5959 }
6060
6161 return http . request ( requestQuery )
6262}
6363
64- export const addImage = ( http , { image, media_type , file_name } ) => {
64+ const addImage = ( http , { image, mediaType , fileName } ) => {
6565 return http . request ( {
6666 method : 'post' ,
6767 url : `/images` ,
6868 data : {
6969 image,
70- file_name,
71- media_type
70+ file_name : fileName ,
71+ media_type : mediaType
7272 }
7373 } )
7474}
7575
76- export const deleteImage = ( http , { id } ) => {
76+ const deleteImage = ( http , { id } ) => {
7777 return http . request ( {
7878 method : 'delete' ,
7979 url : `/images/${ id } `
0 commit comments