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" ADMIN_EMAIL: "admin@example.com"
DATABASE_URL: "postgres://doccano:doccano@postgres:5432/doccano?sslmode=disable" DATABASE_URL: "postgres://doccano:doccano@postgres:5432/doccano?sslmode=disable"
ALLOW_SIGNUP: "False" ALLOW_SIGNUP: "False"
DEBUG: "True"
ports: ports:
- 8000:8000 - 8000:8000
depends_on: depends_on:

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

@ -62,15 +62,12 @@
bottom bottom
> >
<template v-slot:activator="{ on }"> <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> </v-btn>
</template> </template>
<v-list>
<v-list dense>
<v-list-item @click="signout"> <v-list-item @click="signout">
<v-list-item-icon> <v-list-item-icon>
<v-icon>mdi-logout</v-icon> <v-icon>mdi-logout</v-icon>
@ -102,7 +99,8 @@ export default {
{ title: 'Sentiment Analysis', link: 'sentiment-analysis' }, { title: 'Sentiment Analysis', link: 'sentiment-analysis' },
{ title: 'Translation', link: 'translation' }, { title: 'Translation', link: 'translation' },
{ title: 'Text to SQL', link: 'text-to-sql' } { 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) => { .then((result) => {
commit('setToken', result.data.token) commit('setToken', result.data.token)
localStorage.setItem('token', result.data.token) localStorage.setItem('token', result.data.token)
localStorage.setItem('name', authData.username)
Cookie.set('jwt', result.data.token) Cookie.set('jwt', result.data.token)
ApiService.setHeader(result.data.token) ApiService.setHeader(result.data.token)
}) })
@ -55,6 +56,7 @@ export const actions = {
Cookie.remove('jwt') Cookie.remove('jwt')
if (process.client) { if (process.client) {
localStorage.removeItem('token') localStorage.removeItem('token')
localStorage.removeItem('name')
} }
} }
} }
Loading…
Cancel
Save