Skip to content

Instantly share code, notes, and snippets.

@Kelin2025
Created August 22, 2017 16:20
Show Gist options
  • Save Kelin2025/8edf7a09d97f97789e02d15ab1deb20c to your computer and use it in GitHub Desktop.
Save Kelin2025/8edf7a09d97f97789e02d15ab1deb20c to your computer and use it in GitHub Desktop.
Apicase mixins example
import { Container } from 'apicase'
export default new Container({
services: {
posts: {
url: '/posts',
// You can use it for shortcuts
// or more interesting computed properties
mixins: {
success () {
return this.ok && this.result.data.length > 0
},
data () {
return this.success
? this.result.data
: null
},
firstPostName () {
return this.data
? this.data[0].name
: null
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment