Sort sessions alphabetically by title

This commit is contained in:
Oliver Davies 2019-05-25 12:33:43 +01:00
parent 15b093f94e
commit d1e1b08feb
2 changed files with 11 additions and 2 deletions

View file

@ -1,12 +1,13 @@
<template>
<div id="app" class="antialiased min-h-screen font-sans bg-gray-100 text-black p-12">
<accepted-sessions-list :sessions="sessions" />
<accepted-sessions-list :sessions="sortedSessions" />
</div>
</template>
<style src="./css/app.css"></style>
<script>
import _ from 'lodash'
import AcceptedSessionsList from '@/components/AcceptedSessionsList'
const axios = require('axios')
@ -31,6 +32,14 @@ export default {
this.loaded = true
this.sessions = data.data
})
},
computed: {
sortedSessions: function () {
return _(this.sessions).sortBy(session => {
return session.attributes.title
})
}
}
}
</script>

View file

@ -18,7 +18,7 @@ import _ from 'lodash'
export default {
props: {
sessions: {
type: Array,
type: Object,
required: true
}
},