Skip to content

Commit

Permalink
fix(#679): add nuxt auth axios instance to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Nov 2, 2023
1 parent 4ef4189 commit 0d437fa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/menu/templates/plugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DruxtMenu } from 'druxt-menu'

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

Expand All @@ -12,6 +12,14 @@ export default (context, inject) => {
options.menu = <%= JSON.stringify(options.menu) %>
<% } %>

<% 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 druxtMenu = new DruxtMenu(baseUrl, options)
inject('druxtMenu', druxtMenu)
}

0 comments on commit 0d437fa

Please sign in to comment.