October 2018
Intermediate to advanced
590 pages
15h 5m
English
Now, let's implement the register() method itself, starting with configuring axios as follows.
Let's have a look at the frontend/src/main.js file:
import router from './router'import axios from 'axios'// Bootstrap axiosaxios.defaults.baseURL = '/api'axios.defaults.headers.common.Accept = 'application/json'axios.interceptors.response.use( response => response, (error) => { return Promise.reject(error) })
As you can see, in the main.js file, we configure baseURL so that we don't have to add /api for every request. We make it clear that we only accept responses in JSON format, and we also add an interceptor to the response to propagate errors.
Now, let's change the register() method of registrationService to the ...
Read now
Unlock full access