Browse Source

Added username at top

pull/664/head
tusharmakkar08 4 years ago
parent
commit
7b76445d90
3 changed files with 8 additions and 7 deletions
  1. 1
      docker-compose.dev.yml
  2. 12
      frontend/components/organisms/layout/TheHeader.vue
  3. 2
      frontend/store/auth.js

1
docker-compose.dev.yml

@ -13,6 +13,7 @@ services:
ADMIN_EMAIL: "admin@example.com"
DATABASE_URL: "postgres://doccano:doccano@postgres:5432/doccano?sslmode=disable"
ALLOW_SIGNUP: "False"
DEBUG: "True"
ports:
- 8000:8000
depends_on:

12
frontend/components/organisms/layout/TheHeader.vue

@ -62,15 +62,12 @@
bottom
>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
icon
>
<v-icon>mdi-dots-vertical</v-icon>
<v-btn v-on="on" outlined>
{{ username }}
</v-btn>
</template>
<v-list>
<v-list dense>
<v-list-item @click="signout">
<v-list-item-icon>
<v-icon>mdi-logout</v-icon>
@ -102,7 +99,8 @@ export default {
{ title: 'Sentiment Analysis', link: 'sentiment-analysis' },
{ title: 'Translation', link: 'translation' },
{ title: 'Text to SQL', link: 'text-to-sql' }
]
],
username: localStorage.getItem('name')
}
},

2
frontend/store/auth.js

@ -27,6 +27,7 @@ export const actions = {
.then((result) => {
commit('setToken', result.data.token)
localStorage.setItem('token', result.data.token)
localStorage.setItem('name', authData.username)
Cookie.set('jwt', result.data.token)
ApiService.setHeader(result.data.token)
})
@ -55,6 +56,7 @@ export const actions = {
Cookie.remove('jwt')
if (process.client) {
localStorage.removeItem('token')
localStorage.removeItem('name')
}
}
}
Loading…
Cancel
Save