This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/components/ProfileOverview.vue

53 lines
1.7 KiB
Vue
Raw Normal View History

<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">
<Icon v="id-card"/>
<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">
<Icon v="edit"/>
<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')">
<Icon v="trash-alt"/>
2020-10-24 13:32:12 -07:00
</a>
</span>
<span v-else>
2021-01-22 14:54:24 -08:00
<LocaleLink :locale="locale" link="/editor" class="badge bg-light text-dark border">
<Icon v="plus-circle"/>
<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;
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
},
},
}
</script>