Skip to content

Commit

Permalink
Create $Client prototype already instantiated
Browse files Browse the repository at this point in the history
  • Loading branch information
felixheidecke committed May 9, 2018
1 parent e4eff7b commit 16c9266
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<link rel="stylesheet" href="core/css/uikit.owncloud.css" />
</head>
<body>
<section id="oc-scaffold">
<section id="oc-scaffold">
<header>
<top-bar :user="user"></top-bar>
</header>
<aside>
<side-menu :nav='nav'></side-menu>
</aside>
<login-dialog :user="user" :servers="config.servers"></login-dialog>
</section>
</section>
<section id="oc-content" class="uk-offcanvas-content"></section>
<script data-main="/core/js/core.bundle.js" src="/node_modules/requirejs/require.js"></script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Login-Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default {
login () {
this.loading = true;
let OC = this.$parent;
OC.client.setInstance(this.instance);
OC.client.login(this.username, this.password).then(status => {
OC.client.users.getUser(this.username).then(user => {
OC.$Client.setInstance(this.instance);
OC.$Client.login(this.username, this.password).then(status => {
OC.$Client.users.getUser(this.username).then(user => {
this.loading = false;
this._hide();
OC.setUser(user);
Expand Down
13 changes: 8 additions & 5 deletions src/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import Vue from 'vue';
import _ from 'lodash';
import $ from 'jquery';
import Client from 'js-owncloud-client';
import filesize from 'filesize';

// --- Components ---
Expand All @@ -22,11 +21,17 @@ Vue.use(VueBus);

import Helper from './mixins/helper.js';


// --- Add UIkit to the scope ---

import UIkit from 'uikit';
Vue.prototype.$UIkit = UIkit

// Add JS-owncloud-client instance to the scope

import Client from 'js-owncloud-client';
Vue.prototype.$Client = new Client();

OC = new Vue({
el : "#oc-scaffold",
name : "phoenix",
Expand All @@ -51,16 +56,14 @@ OC = new Vue({
email : null,
enabled : false,
home : null
},
client : null
}
},

mounted () {
// Start with loading the config
this._loadConfig();

this.$bus.on('phoenix:config-loaded', () => {
this.client = new Client();
this._setupApps()
});

Expand All @@ -69,7 +72,7 @@ OC = new Vue({
});

this.$bus.on('phoenix:user-logged-in', () => {
this.client.getCapabilities().then(caps => {
this.$Client.getCapabilities().then(caps => {
this.server = caps
});
});
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
entry: './src/default.js',
resolve: {
alias: {
vue: 'vue/dist/vue.min.js'
vue: 'vue/dist/vue.js'
}
},
output: {
Expand Down

0 comments on commit 16c9266

Please sign in to comment.