rudeshark.net/src/client/app/mobile/views/pages/received-follow-requests.vue

70 lines
1.5 KiB
Vue
Raw Normal View History

2018-06-02 06:34:53 +02:00
<template>
2018-06-02 09:13:32 +02:00
<mk-ui>
2019-02-18 01:48:00 +01:00
<template v-slot:header><fa :icon="['far', 'envelope']"/>{{ $t('title') }}</template>
2018-06-02 06:34:53 +02:00
2018-06-02 09:13:32 +02:00
<main>
2018-06-02 08:51:43 +02:00
<div v-for="req in requests">
<router-link :key="req.id" :to="req.follower | userPage">
2018-12-06 08:09:33 +01:00
<mk-user-name :user="req.follower"/>
</router-link>
2018-06-02 08:51:43 +02:00
<span>
<a @click="accept(req.follower)">{{ $t('accept') }}</a>|<a @click="reject(req.follower)">{{ $t('reject') }}</a>
2018-06-02 08:51:43 +02:00
</span>
</div>
2018-06-02 09:13:32 +02:00
</main>
</mk-ui>
2018-06-02 06:34:53 +02:00
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
2018-06-02 09:13:32 +02:00
import Progress from '../../../common/scripts/loading';
2018-06-02 06:34:53 +02:00
export default Vue.extend({
i18n: i18n('mobile/views/pages/received-follow-requests.vue'),
2018-06-02 06:34:53 +02:00
data() {
return {
fetching: true,
requests: []
};
},
mounted() {
document.title = this.$t('title');
2018-06-02 09:13:32 +02:00
Progress.start();
2018-11-09 00:13:34 +01:00
this.$root.api('following/requests/list').then(requests => {
2018-06-02 06:34:53 +02:00
this.fetching = false;
this.requests = requests;
2018-06-02 09:13:32 +02:00
Progress.done();
2018-06-02 06:34:53 +02:00
});
},
methods: {
2018-06-02 08:51:43 +02:00
accept(user) {
2018-11-09 00:13:34 +01:00
this.$root.api('following/requests/accept', { userId: user.id }).then(() => {
2018-06-02 08:51:43 +02:00
this.requests = this.requests.filter(r => r.follower.id != user.id);
});
},
reject(user) {
2018-11-09 00:13:34 +01:00
this.$root.api('following/requests/reject', { userId: user.id }).then(() => {
2018-06-02 08:51:43 +02:00
this.requests = this.requests.filter(r => r.follower.id != user.id);
});
2018-06-02 06:34:53 +02:00
}
}
});
</script>
<style lang="stylus" scoped>
2018-06-02 09:13:32 +02:00
main
2018-06-02 08:51:43 +02:00
> div
display flex
2018-06-02 06:34:53 +02:00
padding 16px
2018-09-28 07:03:55 +02:00
border solid 1px var(--faceDivider)
2018-06-02 06:34:53 +02:00
border-radius 4px
2018-06-02 08:51:43 +02:00
> span
margin 0 0 0 auto
2018-06-02 06:34:53 +02:00
</style>