Refactor & Clean up

This commit is contained in:
syuilo
2018-11-09 08:13:34 +09:00
parent ba845f5218
commit 60ef3e3563
154 changed files with 438 additions and 481 deletions

View File

@@ -69,7 +69,7 @@ export default Vue.extend({
const acct = new URL(location.href).searchParams.get('acct');
this.fetching = true;
Progress.start();
(this as any).api('users/show', parseAcct(acct)).then(user => {
this.$root.api('users/show', parseAcct(acct)).then(user => {
this.user = user;
this.fetching = false;
Progress.done();
@@ -81,20 +81,20 @@ export default Vue.extend({
try {
if (this.user.isFollowing) {
this.user = await (this as any).api('following/delete', {
this.user = await this.$root.api('following/delete', {
userId: this.user.id
});
} else {
if (this.user.hasPendingFollowRequestFromYou) {
this.user = await (this as any).api('following/requests/cancel', {
this.user = await this.$root.api('following/requests/cancel', {
userId: this.user.id
});
} else if (this.user.isLocked) {
this.user = await (this as any).api('following/create', {
this.user = await this.$root.api('following/create', {
userId: this.user.id
});
} else {
this.user = await (this as any).api('following/create', {
this.user = await this.$root.api('following/create', {
userId: this.user.id
});
}