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

79 lines
1.5 KiB
Vue
Raw Normal View History

2018-06-01 23:34:53 -05:00
<template>
2018-06-02 02:13:32 -05:00
<mk-ui>
<span slot="header">%fa:envelope R%%i18n:@title%</span>
2018-06-01 23:34:53 -05:00
2018-06-02 02:13:32 -05:00
<main>
2018-06-02 01:51:43 -05:00
<div v-for="req in requests">
<router-link :key="req.id" :to="req.follower | userPage">{{ req.follower | userName }}</router-link>
<span>
<a @click="accept(req.follower)">%i18n:@accept%</a>|<a @click="reject(req.follower)">%i18n:@reject%</a>
</span>
</div>
2018-06-02 02:13:32 -05:00
</main>
</mk-ui>
2018-06-01 23:34:53 -05:00
</template>
<script lang="ts">
import Vue from 'vue';
2018-06-02 02:13:32 -05:00
import Progress from '../../../common/scripts/loading';
2018-06-01 23:34:53 -05:00
export default Vue.extend({
data() {
return {
fetching: true,
requests: []
};
},
mounted() {
2018-08-06 23:25:50 -05:00
document.title = '%i18n:@title%';
2018-06-02 02:13:32 -05:00
Progress.start();
2018-06-01 23:34:53 -05:00
(this as any).api('following/requests/list').then(requests => {
this.fetching = false;
this.requests = requests;
2018-06-02 02:13:32 -05:00
Progress.done();
2018-06-01 23:34:53 -05:00
});
},
methods: {
2018-06-02 01:51:43 -05:00
accept(user) {
(this as any).api('following/requests/accept', { userId: user.id }).then(() => {
this.requests = this.requests.filter(r => r.follower.id != user.id);
});
},
reject(user) {
(this as any).api('following/requests/reject', { userId: user.id }).then(() => {
this.requests = this.requests.filter(r => r.follower.id != user.id);
});
2018-06-01 23:34:53 -05:00
}
}
});
</script>
<style lang="stylus" scoped>
2018-09-26 06:19:35 -05:00
2018-06-01 23:34:53 -05:00
2018-06-02 02:13:32 -05:00
main
width 100%
max-width 680px
margin 0 auto
padding 8px
2018-06-01 23:34:53 -05:00
2018-06-02 02:13:32 -05:00
@media (min-width 500px)
padding 16px
@media (min-width 600px)
padding 32px
2018-06-01 23:34:53 -05:00
2018-06-02 01:51:43 -05:00
> div
display flex
2018-06-01 23:34:53 -05:00
padding 16px
border solid 1px isDark ? #1c2023 : #eee
border-radius 4px
2018-06-02 01:51:43 -05:00
> span
margin 0 0 0 auto
2018-06-01 23:34:53 -05:00
</style>