Skip to content

Commit

Permalink
feat(#660): add @nuxtjs/axios support to router (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher authored Jul 25, 2023
1 parent 7664d90 commit 8609410
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/weak-years-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"druxt-router": minor
---

feat(#660): added @nuxtjs/axios support to the Router plugin.
5 changes: 4 additions & 1 deletion packages/router/templates/plugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DruxtRouter } from 'druxt-router'

export default (context, inject) => {
export default ({ app }, inject) => {
const baseUrl = '<%= options.baseUrl %>'
const options = {}

Expand All @@ -24,6 +24,9 @@ export default (context, inject) => {
<% if (typeof options.axios === 'object') { %>
// Axios settings.
options.axios = <%= JSON.stringify(options.axios) %>
<% } else { %>
// Use the @nuxtjs/axios module Axios instance.
options.axios = app.$axios
<% } %>
const router = new DruxtRouter(baseUrl, options)
Expand Down

0 comments on commit 8609410

Please sign in to comment.