diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-11-29 11:44:59 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-11-29 13:59:51 +0100 |
commit | 61f8bcf9cd7c5ae3f563cd48f1763b26256d4046 (patch) | |
tree | 0754dbce0c16ec106b71e1815e6e8aad5fde1471 /src/mixins | |
parent | 59858d546d6c564e94172fb1124c1c9a6e8b12b6 (diff) |
Use mixin for current user data
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/mixins')
-rw-r--r-- | src/mixins/currentUserMixin.js | 8 | ||||
-rw-r--r-- | src/mixins/serverData.js | 29 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/mixins/currentUserMixin.js b/src/mixins/currentUserMixin.js index 434aeac5..8bc5adfa 100644 --- a/src/mixins/currentUserMixin.js +++ b/src/mixins/currentUserMixin.js @@ -20,13 +20,19 @@ * */ +import serverData from './serverData' export default { + mixins: [ + serverData + ], computed: { currentUser: function() { return OC.getCurrentUser() }, socialId: function() { - return '@' + OC.getCurrentUser().uid + '@' + OC.getHost() + const url = document.createElement('a') + url.setAttribute('href', this.serverData.cloudAddress) + return '@' + OC.getCurrentUser().uid + '@' + url.hostname } } } diff --git a/src/mixins/serverData.js b/src/mixins/serverData.js new file mode 100644 index 00000000..24783e3c --- /dev/null +++ b/src/mixins/serverData.js @@ -0,0 +1,29 @@ +/* + * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net> + * + * @author Julius Härtl <jus@bitgrid.net> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +export default { + computed: { + serverData: function() { + return this.$store.getters.getServerData + } + } +} |