stash
This commit is contained in:
parent
b7fb0c6fb3
commit
8c01e37224
5 changed files with 63 additions and 7 deletions
|
@ -19,6 +19,8 @@ const store = createStore({
|
|||
users: [],
|
||||
groups: [],
|
||||
state_options: [],
|
||||
messageTemplates: [],
|
||||
messageTemplatesVariables: [],
|
||||
|
||||
lastEvent: '37C3',
|
||||
lastUsed: {},
|
||||
|
@ -201,6 +203,12 @@ const store = createStore({
|
|||
setThumbnail(state, {url, data}) {
|
||||
state.thumbnailCache[url] = data;
|
||||
},
|
||||
setMessageTemplates(state, templates) {
|
||||
state.messageTemplates = templates;
|
||||
},
|
||||
setMessageTemplateVariables(state, variables) {
|
||||
state.messageTemplatesVariables = variables;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async login({commit}, {username, password, remember}) {
|
||||
|
@ -415,7 +423,19 @@ const store = createStore({
|
|||
async updateTicketPartial({commit, state}, {id, ...ticket}) {
|
||||
const {data, success} = await http.patch(`/2/tickets/${id}/`, ticket, state.user.token);
|
||||
commit('updateTicket', data);
|
||||
}
|
||||
},
|
||||
async fetchMessageTemplates({commit, state}) {
|
||||
const {data, success} = await http.get('/2/message_templates/', state.user.token);
|
||||
if (data && success) {
|
||||
commit('setMessageTemplates', data);
|
||||
}
|
||||
},
|
||||
async fetchMessageTemplateVariables({commit, state}) {
|
||||
const {data, success} = await http.get('/2/message_template_variables/', state.user.token);
|
||||
if (data && success) {
|
||||
commit('setMessageTemplateVariables', data);
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
persistentStatePlugin({ // TODO change remember to some kind of enable field
|
||||
|
@ -443,6 +463,8 @@ const store = createStore({
|
|||
"groups",
|
||||
"loadedBoxes",
|
||||
"loadedItems",
|
||||
"messageTemplates",
|
||||
"messageTemplatesVariables",
|
||||
],
|
||||
watch: [
|
||||
"test",
|
||||
|
@ -453,6 +475,8 @@ const store = createStore({
|
|||
"groups",
|
||||
"loadedBoxes",
|
||||
"loadedItems",
|
||||
"messageTemplates",
|
||||
"messageTemplatesVariables",
|
||||
],
|
||||
mutations: [
|
||||
//"replaceTickets",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue