story-content: Added tag add/remove modal
This commit is contained in:
@@ -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
@@ -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))
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user