Skip to content

Commit 451f116

Browse files
committed
feat(package): options have moved to constructor
You now have to instantiate the plugin with a options parameter: Vue.use(AspnetAuth, { url: 'http://localhost' });
1 parent b512841 commit 451f116

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vscode/
2+
node_modules/
3+
coverage/

src/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
import aspnetAuth from 'aspnet-auth';
1111
export const AspnetAuth = {
12-
install(Vue) {
13-
Vue.prototype.$auth = new aspnetAuth({
14-
url: 'http://localhost'
15-
});
12+
install(Vue, options) {
13+
Vue.prototype.$auth = new aspnetAuth(options);
1614
}
1715
}

test/.eslintrc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
"mocha": true
44
},
55
"rules": {
6-
"import/no-extraneous-dependencies": [
7-
"error",
8-
{
9-
"optionalDependencies": false,
10-
"peerDependencies": false
11-
}
12-
],
13-
"no-unused-expressions": "off",
14-
"padded-blocks": "off",
156
"no-console": "off"
167
}
178
}

test/vue-aspnet-auth-Spec.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ describe('vue-aspnet-auth', () => {
1717

1818
before(() => {
1919
sinon.stub(cookies, 'get').returns(null);
20-
Vue.use(AspnetAuth);
20+
Vue.use(AspnetAuth, {
21+
url: 'http://localhost'
22+
});
2123
});
2224
after(() => {
2325
cookies.get.restore();
2426
});
2527

28+
it('should receive the url as an option', () => {
29+
expect(Vue.prototype.$auth.options.url).to.eq('http://localhost');
30+
});
31+
2632
it('attached itself to vue as $auth', () => {
2733
expect(Vue.prototype.$auth).to.be.an('object');
2834
});

0 commit comments

Comments
 (0)