@@ -35,7 +35,7 @@ enum ActionType {
3535
3636const reducer = ( state , action ) => {
3737 switch ( action . type ) {
38- case ActionType . LoadData :
38+ case ActionType . LoadData : {
3939 return {
4040 ...action . payload ,
4141 __typename : undefined ,
@@ -44,7 +44,8 @@ const reducer = (state, action) => {
4444 __typename : undefined ,
4545 } ) ) ,
4646 } ;
47- case ActionType . AddPage :
47+ }
48+ case ActionType . AddPage : {
4849 return {
4950 ...state ,
5051 pages : [
@@ -56,12 +57,14 @@ const reducer = (state, action) => {
5657 } ,
5758 ] ,
5859 } ;
59- case ActionType . RemovePage :
60+ }
61+ case ActionType . RemovePage : {
6062 return {
6163 ...state ,
6264 pages : state . pages . filter ( ( page ) => page . id !== action . payload . pageId ) ,
6365 } ;
64- case ActionType . SetContent :
66+ }
67+ case ActionType . SetContent : {
6568 const { pageId, content } = action . payload ;
6669 if ( pageId === "header" || pageId === "footer" ) {
6770 return {
@@ -76,7 +79,8 @@ const reducer = (state, action) => {
7679 page . id === pageId ? { ...page , content } : page ,
7780 ) ,
7881 } ;
79- case ActionType . MovePageUp :
82+ }
83+ case ActionType . MovePageUp : {
8084 const pageIndex = state . pages . findIndex (
8185 ( page ) => page . id === action . payload . pageId ,
8286 ) ;
@@ -94,7 +98,8 @@ const reducer = (state, action) => {
9498 ...state ,
9599 pages,
96100 } ;
97- case ActionType . MovePageDown :
101+ }
102+ case ActionType . MovePageDown : {
98103 const pageIndexDown = state . pages . findIndex (
99104 ( page ) => page . id === action . payload . pageId ,
100105 ) ;
@@ -113,6 +118,7 @@ const reducer = (state, action) => {
113118 ...state ,
114119 pages : pagesDown ,
115120 } ;
121+ }
116122 }
117123 return state ;
118124} ;
0 commit comments