Implementing the services and Vuex store

Before we implement the Vuex store, let's get those services created. We will need to create teamService in the front-end/src/services/teams.js file, which looks like this:

...export default {  /**   * Create a team   * @param {*} detail the detail of the team   */  create (detail) {    return new Promise((resolve, reject) => {      axios.post('/teams', detail).then(({data}) => {        resolve(data)      }).catch((error) => {        reject(errorParser.parse(error))      })    })  }}

As you can see, this service only has one method, create(), which send the team's detail to /api/teams in a POST request.

We will also need to create boardService, which is very similar to teamService, as you can see:

...export default {  /** * Create a new board ...

Get Building Applications with Spring 5 and Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.