2018-06-02 13:34:53 +09:00
|
|
|
<template>
|
2019-05-18 20:36:33 +09:00
|
|
|
<div>
|
|
|
|
<ui-container :body-togglable="true">
|
|
|
|
<template #header>{{ $t('received-follow-requests') }}</template>
|
|
|
|
<div v-if="!fetching">
|
2019-05-19 20:47:41 +09:00
|
|
|
<sequential-entrance animation="entranceFromTop" delay="25" tag="div">
|
|
|
|
<div v-for="req in requests" class="mcbzkkaw">
|
2019-05-18 20:36:33 +09:00
|
|
|
<router-link :key="req.id" :to="req.follower | userPage">
|
|
|
|
<mk-user-name :user="req.follower"/>
|
|
|
|
</router-link>
|
|
|
|
<span>
|
|
|
|
<a @click="accept(req.follower)">{{ $t('accept') }}</a>|<a @click="reject(req.follower)">{{ $t('reject') }}</a>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</sequential-entrance>
|
2018-06-02 15:51:43 +09:00
|
|
|
</div>
|
2019-05-18 20:36:33 +09:00
|
|
|
</ui-container>
|
|
|
|
</div>
|
2018-06-02 13:34:53 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-09 03:44:35 +09:00
|
|
|
import i18n from '../../../i18n';
|
2019-05-18 20:36:33 +09:00
|
|
|
import Progress from '../../scripts/loading';
|
2018-06-02 16:13:32 +09:00
|
|
|
|
2018-06-02 13:34:53 +09:00
|
|
|
export default Vue.extend({
|
2019-05-18 20:36:33 +09:00
|
|
|
i18n: i18n('common/views/pages/follow-requests.vue'),
|
2018-06-02 13:34:53 +09:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
|
|
|
requests: []
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-06-02 16:13:32 +09:00
|
|
|
Progress.start();
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('following/requests/list').then(requests => {
|
2018-06-02 13:34:53 +09:00
|
|
|
this.fetching = false;
|
|
|
|
this.requests = requests;
|
2018-06-02 16:13:32 +09:00
|
|
|
Progress.done();
|
2018-06-02 13:34:53 +09:00
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
2018-06-02 15:51:43 +09:00
|
|
|
accept(user) {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('following/requests/accept', { userId: user.id }).then(() => {
|
2018-06-02 15:51:43 +09:00
|
|
|
this.requests = this.requests.filter(r => r.follower.id != user.id);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
reject(user) {
|
2018-11-09 08:13:34 +09:00
|
|
|
this.$root.api('following/requests/reject', { userId: user.id }).then(() => {
|
2018-06-02 15:51:43 +09:00
|
|
|
this.requests = this.requests.filter(r => r.follower.id != user.id);
|
|
|
|
});
|
2018-06-02 13:34:53 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2019-05-18 20:36:33 +09:00
|
|
|
.mcbzkkaw
|
2019-05-19 20:47:41 +09:00
|
|
|
display flex
|
|
|
|
padding 16px
|
|
|
|
border solid 1px var(--faceDivider)
|
|
|
|
border-radius 4px
|
2018-06-02 13:34:53 +09:00
|
|
|
|
2019-05-19 20:47:41 +09:00
|
|
|
> span
|
|
|
|
margin 0 0 0 auto
|
2018-06-02 15:51:43 +09:00
|
|
|
|
2018-06-02 13:34:53 +09:00
|
|
|
</style>
|