2020-10-17 09:19:11 -07:00
|
|
|
<template>
|
|
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
|
|
{{ locales[locale].name }}
|
|
|
|
<span v-if="profile">
|
2021-04-01 09:24:47 -07:00
|
|
|
<LocaleLink :locale="locale" :link="`/@${profile.username}`" class="badge bg-primary text-white text-white">
|
2020-10-18 02:43:56 -07:00
|
|
|
<Icon v="id-card"/>
|
2020-10-17 09:19:11 -07:00
|
|
|
<T>profile.show</T>
|
|
|
|
</LocaleLink>
|
2021-01-22 14:54:24 -08:00
|
|
|
<LocaleLink :locale="locale" link="/editor" class="badge bg-light text-dark border">
|
2020-10-18 02:43:56 -07:00
|
|
|
<Icon v="edit"/>
|
2020-10-17 09:19:11 -07:00
|
|
|
<T>profile.edit</T>
|
|
|
|
</LocaleLink>
|
2020-10-24 13:32:12 -07:00
|
|
|
<Spinner v-if="deleting"/>
|
2021-01-22 14:54:24 -08:00
|
|
|
<a v-else href="#" class="badge bg-light text-dark" @click.prevent="removeProfile(locale)" :aria-label="$t('profile.delete')">
|
2020-10-18 02:43:56 -07:00
|
|
|
<Icon v="trash-alt"/>
|
2020-10-24 13:32:12 -07:00
|
|
|
</a>
|
2020-10-17 09:19:11 -07:00
|
|
|
</span>
|
|
|
|
<span v-else>
|
2021-01-22 14:54:24 -08:00
|
|
|
<LocaleLink :locale="locale" link="/editor" class="badge bg-light text-dark border">
|
2020-10-18 02:43:56 -07:00
|
|
|
<Icon v="plus-circle"/>
|
2020-10-17 09:19:11 -07:00
|
|
|
<T>profile.init</T>
|
|
|
|
</LocaleLink>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
profile: { required: true },
|
|
|
|
locale: { required: true },
|
2020-10-24 13:32:12 -07:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
deleting: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2020-10-31 13:33:59 -07:00
|
|
|
async removeProfile(locale) {
|
2020-10-24 13:32:12 -07:00
|
|
|
await this.$confirm(this.$t('profile.deleteConfirm'), 'danger');
|
|
|
|
|
|
|
|
this.deleting = true;
|
2021-06-09 09:06:32 -07:00
|
|
|
try {
|
|
|
|
const response = await this.$post(`/profile/delete/${locale}`);
|
|
|
|
this.$emit('update', response);
|
|
|
|
} finally {
|
|
|
|
this.deleting = false;
|
|
|
|
}
|
2020-10-24 13:32:12 -07:00
|
|
|
},
|
|
|
|
},
|
2020-10-17 09:19:11 -07:00
|
|
|
}
|
|
|
|
</script>
|