({dispatch, state})
| 57 | }, |
| 58 | |
| 59 | save({dispatch, state}) { |
| 60 | const oldName = state.scriptName; |
| 61 | const newName = state.scriptConfig.name; |
| 62 | |
| 63 | const formData = prepareConfigForSave(state.scriptConfig, state.scriptFilename) |
| 64 | |
| 65 | const axiosAction = state.new ? axiosInstance.post : axiosInstance.put; |
| 66 | |
| 67 | return axiosAction('admin/scripts', formData) |
| 68 | .then(() => { |
| 69 | if (oldName === newName) { |
| 70 | dispatch('init', newName); |
| 71 | } else { |
| 72 | router.push({ |
| 73 | path: `/scripts/${encodeURIComponent(newName)}` |
| 74 | }); |
| 75 | } |
| 76 | }) |
| 77 | .catch(e => { |
| 78 | if ((e.response.status === 422) || (e.response.status === 403)) { |
| 79 | e.userMessage = e.response.data; |
| 80 | } |
| 81 | throw e; |
| 82 | }); |
| 83 | }, |
| 84 | |
| 85 | deleteScript({state}) { |
| 86 | const oldName = state.scriptName; |
nothing calls this directly
no test coverage detected