Commit dd20613c authored by Clement Ho's avatar Clement Ho

[skip ci] remove additional promise for vueresource

parent 34f689e4
...@@ -7,10 +7,12 @@ export default { ...@@ -7,10 +7,12 @@ export default {
methods: { methods: {
assignSelf() { assignSelf() {
this.service.add(this.assignees.currentUser.id).then((response) => { this.service.add(this.assignees.currentUser.id).then((response) => {
const assignee = response.assignee; const data = response.data;
const assignee = data.assignee;
this.assignees.addUser(assignee.name, assignee.username, assignee.avatar_url); this.assignees.addUser(assignee.name, assignee.username, assignee.avatar_url);
}).catch((err) => { }).catch((err) => {
console.log('error') console.log(err);
console.log('error');
}); });
} }
}, },
......
...@@ -5,7 +5,7 @@ export default { ...@@ -5,7 +5,7 @@ export default {
}, },
template: ` template: `
<div class="value hide-collapsed"> <div class="value hide-collapsed">
<a class="author_link bold" :href="user.url"> <a class="author_link bold" :href="'/' + user.username">
<img width="32" class="avatar avatar-inline s32" alt="" :src="user.avatarUrl"> <img width="32" class="avatar avatar-inline s32" alt="" :src="user.avatarUrl">
<span class="author">{{user.name}}</span> <span class="author">{{user.name}}</span>
<span class="username">@{{user.username}}</span> <span class="username">@{{user.username}}</span>
......
...@@ -3,7 +3,6 @@ import VueResource from 'vue-resource'; ...@@ -3,7 +3,6 @@ import VueResource from 'vue-resource';
require('~/vue_shared/vue_resource_interceptor'); require('~/vue_shared/vue_resource_interceptor');
Vue.http.options.emulateJSON = true;
Vue.use(VueResource); Vue.use(VueResource);
export default class SidebarAssigneesService { export default class SidebarAssigneesService {
...@@ -13,13 +12,10 @@ export default class SidebarAssigneesService { ...@@ -13,13 +12,10 @@ export default class SidebarAssigneesService {
} }
add(userId) { add(userId) {
return new Promise((resolve, reject) => { return this.sidebarAssigneeResource.update({
this.sidebarAssigneeResource.update({ [this.field]: userId }) [this.field]: userId
.then((response) => { }, {
resolve(JSON.parse(response.body)) emulateJSON: true
}, (response) => {
reject(response)
});
}); });
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment