Sha256: e5cc4ff0ec796002c7aa568b8a7e7e371c2ded76fbe0c5cba526c980dd000396

Contents?: true

Size: 690 Bytes

Versions: 7

Compression:

Stored size: 690 Bytes

Contents

export default (api) => ({
  findAll: (page, perPage, query) => {
    const options = { params: { page, perPage, query, assetType: 'image' } }
    return api.get('/assets', options).then(({ data }) => data)
  },

  find: (id) => {
    return api.get(`/assets/${id}`).then(({ data }) => data)
  },

  destroy: (id) => {
    return api.destroy(`/assets/${id}`).then(({ data }) => data)
  },

  create: (attributes) => {
    let formData = new FormData()
    Object.entries(attributes).forEach(([key, value]) =>
      formData.append(`asset[${key}]`, value)
    )
    return api.post('/assets', formData, {
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  },
})

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
maglevcms-1.7.3 app/frontend/editor/services/image.js
maglevcms-1.7.2 app/frontend/editor/services/image.js
maglevcms-1.7.1 app/frontend/editor/services/image.js
maglevcms-1.7.0 app/frontend/editor/services/image.js
maglevcms-1.6.1 app/frontend/editor/services/image.js
maglevcms-1.6.0 app/frontend/editor/services/image.js
maglevcms-1.5.1 app/frontend/editor/services/image.js