Skip to content
Snippets Groups Projects
Commit 2202dd85 authored by thomas.blanc.2@etu.univ-amu.fr's avatar thomas.blanc.2@etu.univ-amu.fr
Browse files

Fixed login/register flow

parent 4cc6dad2
Branches
No related tags found
No related merge requests found
......@@ -45,6 +45,7 @@ export default {
console.log('LOGIN TOKEN OK')
await localStorage.setItem('token', response.message)
this.$parent.close()
this.$router.push({ name: 'Account' })
this.$router.go()
} else {
this.errorMessage = 'Username or password incorect'
......
<template>
<b-table :data="models" :loading="isLoading" striped hoverable>
<template slot-scope="props">
<b-table-column field="name" label="Model name" searchable sortable>
{{ props.row.name }} <b-icon v-if="props.row.isVerified" icon="check"/>
</b-table-column>
<b-table-column field="vote" label="Votes" sortable>
{{ props.row.votes }}
</b-table-column>
<b-table-column field="date" label="Last modification" centered sortable>
{{ new Date(props.row.lastModified).toLocaleDateString() }}
</b-table-column>
<b-table-column field="date" label="Added" centered sortable>
{{ new Date(props.row.added).toLocaleDateString() }}
</b-table-column>
<b-table-column label="" centered>
<b-button class="actionButton" icon-left="eye" type="is-info" tag="router-link" :to="{ name: 'Model', query: { id: props.row.id } }" outlined/>
<b-button class="actionButton" icon-left="pencil" type="is-warning" tag="router-link" :to="{ name: 'ModelEdit', params: {model: props.row} }" outlined/>
<b-button class="actionButton" icon-left="delete" type="is-danger" @click="removePrompt(props.row.id, props.row.name)" outlined/>
</b-table-column>
</template>
</b-table>
</template>
<script>
import { api } from '@/api.js'
export default {
name: 'ModelTable',
data () {
return {
isLoading: true,
models: []
}
},
async mounted () {
this.models = await api.getUserModels()
this.isLoading = false
},
methods: {
removePrompt (id, name) {
this.$buefy.dialog.confirm({
message: 'Delete ' + name + ' ?',
cancelText: 'Abort',
confirmText: 'Delete',
type: 'is-danger',
hasIcon: true,
onConfirm: async () => {
await api.removeModel(id)
this.$buefy.toast.open(name + ' deleted')
this.models = await api.getUserModels()
}
})
}
}
}
</script>
<style scoped>
.actionButton {
margin-left:8px;
}
</style>
......@@ -56,6 +56,7 @@ export default {
} else {
await localStorage.setItem('token', response.message)
this.$parent.close()
this.$router.push({ name: 'Account' })
this.$router.go()
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment