Skip to content

Commit 356b31f

Browse files
author
Pooya Parsa
committed
fix: inject $axios in current ctx
#18
1 parent bcd4710 commit 356b31f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: lib/plugin.template.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,14 @@ export default <% if (options.init) { %>async<% } %>(ctx, inject) => {
181181
axios.interceptors.response.use(undefined, customErrorHandler.bind(ctx))
182182
<% } %>
183183

184+
// Inject axios to the context as $axios
185+
ctx.$axios = axios
186+
inject('axios', axios)
187+
184188
<% if (options.init) { %>
185189
await initHook(axios, ctx)
186190
<% } %>
187191

188-
// Inject axios to the context as $axios
189-
inject('axios', axios)
190192

191193
// Setup axios helpers
192194
setupHelpers(axios)

0 commit comments

Comments
 (0)