diff --git a/src/App.vue b/src/App.vue
index a88ca05..6384644 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,7 +2,7 @@
@@ -39,12 +39,6 @@ export default {
})
},
- methods: {
- addSession: function (attributes) {
- this.sessions.push({attributes})
- }
- },
-
computed: {
sortedSessions: function () {
return _(this.sessions).sortBy(session => {
diff --git a/src/components/SessionForm.vue b/src/components/SessionForm.vue
index 2546cd1..20a5c1e 100644
--- a/src/components/SessionForm.vue
+++ b/src/components/SessionForm.vue
@@ -27,17 +27,45 @@ export default {
form: {
body: '',
title: '',
- field_session_status: 'accepted'
+ field_session_status: 'accepted',
+ field_session_type: 'full',
}
}
},
methods: {
submit () {
- this.$emit('submit', _.clone(this.form))
+ const uuid = '11dad4c2-baa8-4fb2-97c6-12e1ce925806' // User 1
- this.form.body = ''
- this.form.title = ''
+ const data = {
+ type: 'node--session',
+ attributes: this.form,
+ relationships: {
+ "field_speakers": {
+ "data": {
+ "type": "user--user",
+ "id": uuid
+ }
+ },
+ }
+ }
+
+ axios({
+ method: 'post',
+ url: 'http://drupaltestcamp.docksal/jsonapi/node/session',
+ data: { data },
+ headers: {
+ 'Accept': 'application/vnd.api+json',
+ 'Content-Type': 'application/vnd.api+json',
+ }
+ })
+ .then(({ data }) => {
+ this.form.body = ''
+ this.form.title = ''
+ })
+ .catch(function (error) {
+ console.log(error)
+ });
}
}
}