1- import { Action , AsyncAction } from 'app/overmind' ;
21import getTemplate from '@codesandbox/common/lib/templates' ;
2+ import { CustomTemplate } from '@codesandbox/common/lib/types' ;
33import slugify from '@codesandbox/common/lib/utils/slugify' ;
4+ import { Action , AsyncAction } from 'app/overmind' ;
45import { withOwnedSandbox } from 'app/overmind/factories' ;
5- import { CustomTemplate } from '@codesandbox/common/lib/types' ;
66
77export const valueChanged : Action < {
88 field : string ;
@@ -218,15 +218,13 @@ export const deleteTemplate: AsyncAction = async ({
218218 }
219219} ;
220220
221- export const editTemplate : AsyncAction = async ( {
222- state,
223- actions,
224- effects,
225- } ) => {
221+ export const editTemplate : AsyncAction < { template : CustomTemplate } > = async (
222+ { state, actions, effects } ,
223+ { template }
224+ ) => {
226225 effects . analytics . track ( 'Template - Edited' , { source : 'editor' } ) ;
227226
228227 const sandboxId = state . editor . currentId ;
229- const template = state . editor . currentSandbox . customTemplate ;
230228
231229 try {
232230 const updatedTemplate = await effects . api . updateTemplate (
@@ -236,7 +234,7 @@ export const editTemplate: AsyncAction = async ({
236234
237235 actions . modalClosed ( ) ;
238236 state . editor . currentSandbox . customTemplate = updatedTemplate ;
239- effects . notificationToast . success ( 'Templated Edited' ) ;
237+ effects . notificationToast . success ( 'Template Edited' ) ;
240238 } catch ( error ) {
241239 effects . notificationToast . error ( 'Could not edit custom template' ) ;
242240 }
0 commit comments