Skip to content

EventService axios instance #10

Open
@davestewart

Description

@davestewart

In lesson 8, Greg creates a new Axios instance:

import axios from 'axios'
    
const apiClient = axios.create({
  baseURL: `http://localhost:3000`,
  withCredentials: false,
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json'
  }
})

However, in lesson 6 we already installed and configured the Nuxt Axios module which "gives you a bunch of additional features out of the box":

nuxt.config.js
module.exports = {
  modules: [
    '@nuxtjs/axios',
  ]
}

Seeing as we are not using this module in the service, I presume we don't get these benefits, or any of the configuration benefits?

Could we use the original Nuxt instance / is there even a way to use this, so:

import client from `...`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions