Skip to content

Commit

Permalink
perf: move init outside of plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Sep 6, 2017
1 parent 88961d4 commit bcd4710
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/plugin.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ const baseURL = process.browser
? (process.env.API_URL_BROWSER || '<%= options.browserBaseURL %>')
: (process.env.API_URL || '<%= options.baseURL %>')

// Custom init hook
<% if (options.init) { %>
const initHook = <%= serialize(options.init).replace('init(', 'function(').replace('function function', 'function') %>
<% } %>

export default <% if (options.init) { %>async<% } %>(ctx, inject) => {
const { app, store, req } = ctx

Expand Down Expand Up @@ -126,11 +131,6 @@ export default <% if (options.init) { %>async<% } %>(ctx, inject) => {
headers
})

// Custom init hook
<% if (options.init) { %>
const initHook = <%= serialize(options.init).replace('init(', 'function(').replace('function function', 'function') %>
<% } %>

<% if (options.credentials) { %>
// Send credentials only to relative and API Backend requests
axios.interceptors.request.use(config => {
Expand Down

0 comments on commit bcd4710

Please sign in to comment.