| 40 | namespaced: true, |
| 41 | actions: { |
| 42 | init({commit, state}, scriptName) { |
| 43 | if (scriptName === NEW_SCRIPT) { |
| 44 | commit('INIT_NEW_SCRIPT'); |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | commit('RESET', scriptName); |
| 49 | |
| 50 | axiosInstance.get('admin/scripts/' + encodeURIComponent(scriptName)) |
| 51 | .then(({data}) => { |
| 52 | commit('SET_SCRIPT_CONFIG', {config: data.config, filename: data.filename}); |
| 53 | }) |
| 54 | .catch((error) => { |
| 55 | commit('SET_LOAD_ERROR', 'Failed to load script config') |
| 56 | }); |
| 57 | }, |
| 58 | |
| 59 | save({dispatch, state}) { |
| 60 | const oldName = state.scriptName; |