Skip to content

Commit 597c3e4

Browse files
christianalfoniSaraVieira
authored andcommitted
Fix issue with updating template and also a typo (codesandbox#2492)
1 parent d38d00b commit 597c3e4

File tree

1 file changed

+7
-9
lines changed
  • packages/app/src/app/overmind/namespaces/workspace

1 file changed

+7
-9
lines changed

packages/app/src/app/overmind/namespaces/workspace/actions.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Action, AsyncAction } from 'app/overmind';
21
import getTemplate from '@codesandbox/common/lib/templates';
2+
import { CustomTemplate } from '@codesandbox/common/lib/types';
33
import slugify from '@codesandbox/common/lib/utils/slugify';
4+
import { Action, AsyncAction } from 'app/overmind';
45
import { withOwnedSandbox } from 'app/overmind/factories';
5-
import { CustomTemplate } from '@codesandbox/common/lib/types';
66

77
export 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

Comments
 (0)