story: Added add story modal, reorganized story page to allow modals and live updates.

This commit is contained in:
2018-09-23 15:57:53 +02:00
parent a2d949edaf
commit ae31accd81
13 changed files with 201 additions and 8 deletions
+44
View File
@@ -194,6 +194,50 @@ const storyApi = {
})
},
/**
* Call `addStory(input)` mutation, returns the ID.
*
* @param {{name:string, category:string, author:string, open:boolean, listed:boolean, fictionalDate:Date, tags:Tag[]}} input
* @returns {Promise<Story>}
*/
add(input) {
return query(`
mutation AddStory($input: StoryAddInput!) {
addStory(input:$input) {
id
name
author
category
tags {
kind
name
}
listed
open
createdDate
fictionalDate
updatedDate
chapters {
id
title
author
source
createdDate
fictionalDate
editedDate
}
}
}
`, {input}, {permissions: ["member", "story.edit"]}).then(({addStory}) => {
return new Story(
addStory.id, addStory.name, addStory.author, addStory.category,
addStory.listed, addStory.open,
addStory.createdDate, addStory.updatedDate, addStory.fictionalDate,
addStory.tags, addStory.chapters
)
})
},
/**
* Call `editStory(input)` mutation, returns the changable fields.
*