Skip to content

Commit 440d46b

Browse files
authored
feat: handle multiple uses (#124)
1 parent 47ea281 commit 440d46b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* @param {axios|Record<string:axios>}options
55
*/
66
function plugin(app, options) {
7-
if (plugin.installed) {
8-
return;
7+
if (app.vueAxiosInstalled) {
8+
return
99
}
1010

1111
const normalizedConfig = isAxiosLike(options) ? migrateToMultipleInstances(options) : options;
@@ -14,8 +14,6 @@ function plugin(app, options) {
1414
return;
1515
}
1616

17-
plugin.installed = true;
18-
1917
const vueVersion = getVueVersion(app);
2018
if (!vueVersion) {
2119
console.error('[vue-axios] unknown Vue version');
@@ -25,6 +23,8 @@ function plugin(app, options) {
2523
Object.keys(normalizedConfig).forEach(registrationKey => {
2624
handler(app, registrationKey, normalizedConfig[registrationKey])
2725
})
26+
27+
app.vueAxiosInstalled = true;
2828
}
2929

3030
if (typeof exports == "object") {

0 commit comments

Comments
 (0)