diff options
Diffstat (limited to 'app/assets/javascripts/profile/index.js')
-rw-r--r-- | app/assets/javascripts/profile/index.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/assets/javascripts/profile/index.js b/app/assets/javascripts/profile/index.js index 5378ed3d743..fbe0e3534d8 100644 --- a/app/assets/javascripts/profile/index.js +++ b/app/assets/javascripts/profile/index.js @@ -1,16 +1,52 @@ import Vue from 'vue'; +import VueApollo from 'vue-apollo'; + +import createDefaultClient from '~/lib/graphql'; import ProfileTabs from './components/profile_tabs.vue'; +import UserAchievements from './components/user_achievements.vue'; + +Vue.use(VueApollo); export const initProfileTabs = () => { const el = document.getElementById('js-profile-tabs'); if (!el) return false; + const { followees, followers, userCalendarPath, utcOffset } = el.dataset; + return new Vue({ el, + provide: { + followees: parseInt(followers, 10), + followers: parseInt(followees, 10), + userCalendarPath, + utcOffset, + }, render(createElement) { return createElement(ProfileTabs); }, }); }; + +export const initUserAchievements = () => { + const el = document.getElementById('js-user-achievements'); + + if (!el) return false; + + const { rootUrl, userId } = el.dataset; + + const apolloProvider = new VueApollo({ + defaultClient: createDefaultClient(), + }); + + return new Vue({ + el, + apolloProvider, + name: 'UserAchievements', + provide: { rootUrl, userId: parseInt(userId, 10) }, + render(createElement) { + return createElement(UserAchievements); + }, + }); +}; |