Skip to content

Commit

Permalink
Merge pull request #41 from ngdangdat/feature/master/user-profile-page
Browse files Browse the repository at this point in the history
feature[profile]: Add profile page
  • Loading branch information
tuandm authored May 9, 2019
2 parents 5afb3c1 + a66bb68 commit 9137f9f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions resources/js/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default {
github: 'Github',
theme: 'Theme',
size: 'Global Size',
profile: 'Profile',
},
login: {
title: 'Login Form',
Expand Down
1 change: 1 addition & 0 deletions resources/js/lang/vi.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default {
screenfull: 'Toàn màn hình',
theme: 'Theme',
size: 'Global Size',
profile: 'Trang cá nhân',
},
login: {
title: 'Đăng nhập',
Expand Down
1 change: 1 addition & 0 deletions resources/js/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default {
github: '项目地址',
theme: '换肤',
size: '布局大小',
profile: '轮廓',
},
login: {
title: '系统登录',
Expand Down
6 changes: 6 additions & 0 deletions resources/js/layout/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
{{ $t('navbar.dashboard') }}
</el-dropdown-item>
</router-link>
<router-link v-show="userId !== null" :to="`/administrator/users/edit/${userId}`">
<el-dropdown-item>
{{ $t('navbar.profile') }}
</el-dropdown-item>
</router-link>
<a target="_blank" href="https://github.com/tuandm/laravue/">
<el-dropdown-item>
{{ $t('navbar.github') }}
Expand Down Expand Up @@ -67,6 +72,7 @@ export default {
'name',
'avatar',
'device',
'userId',
]),
},
methods: {
Expand Down
1 change: 1 addition & 0 deletions resources/js/store/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const getters = {
device: state => state.app.device,
visitedViews: state => state.tagsView.visitedViews,
cachedViews: state => state.tagsView.cachedViews,
userId: state => state.user.id,
token: state => state.user.token,
avatar: state => state.user.avatar,
name: state => state.user.name,
Expand Down
7 changes: 6 additions & 1 deletion resources/js/store/modules/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import router, { resetRouter } from '@/router';
import store from '@/store';

const state = {
id: null,
token: getToken(),
name: '',
avatar: '',
Expand All @@ -13,6 +14,9 @@ const state = {
};

const mutations = {
SET_ID: (state, id) => {
state.id = id;
},
SET_TOKEN: (state, token) => {
state.token = token;
},
Expand Down Expand Up @@ -61,7 +65,7 @@ const actions = {
reject('Verification failed, please Login again.');
}

const { roles, name, avatar, introduction, permissions } = data;
const { roles, name, avatar, introduction, permissions, id } = data;
// roles must be a non-empty array
if (!roles || roles.length <= 0) {
reject('getInfo: roles must be a non-null array!');
Expand All @@ -72,6 +76,7 @@ const actions = {
commit('SET_NAME', name);
commit('SET_AVATAR', avatar);
commit('SET_INTRODUCTION', introduction);
commit('SET_ID', id);
resolve(data);
})
.catch(error => {
Expand Down

0 comments on commit 9137f9f

Please sign in to comment.