story-content: Added tag add/remove modal

This commit is contained in:
2018-09-22 15:33:10 +02:00
parent bf6fbf92e9
commit 2e8737505e
14 changed files with 278 additions and 13 deletions
+42
View File
@@ -142,6 +142,48 @@ const storyApi = {
return data.categories
})
},
/**
* Call `addStoryTag(input)` mutation, returns the new tag list.
*
* @param {{id:string, tag:Tag}} input
* @returns {Promise<{tags: Tag[]}>}
*/
addTag(input) {
return query(`
mutation AddStoryTag($input: StoryTagAddInput!) {
addStoryTag(input:$input) {
tags {
kind
name
}
}
}
`, {input}, {permissions: ["member", "story.edit"]}).then(({addStoryTag}) => {
return addStoryTag
})
},
/**
* Call `removeStoryTag(input)` mutation, returns the new tag list.
*
* @param {{id:string, tag:Tag}} input
* @returns {Promise<{tags: Tag[]}>}
*/
removeTag(input) {
return query(`
mutation RemoveStoryTag($input: StoryTagRemoveInput!) {
removeStoryTag(input:$input) {
tags {
kind
name
}
}
}
`, {input}, {permissions: ["member", "story.edit"]}).then(({removeStoryTag}) => {
return removeStoryTag
})
},
}
module.exports = {storyApi, Story}
+1 -1
View File
@@ -26,7 +26,7 @@ const tagApi = {
}
}
`, {}).then(({tags}) => {
return tags.map(d => new Tag(d))
return tags.map(d => new Tag(d.kind, d.name))
})
},
}