@@ -4,9 +4,9 @@ import Home from './pages/home/home';
44import Switch from 'react-switch' ;
55import { FaSun , FaMoon } from 'react-icons/fa' ;
66import { useReducer , useState } from 'react' ;
7- import { NoteType } from './components/note/note-type' ;
87import { StateContext , StateType } from './context/state/state' ;
98import { Notes } from './components/note/data' ;
9+ import { ADD_NOTE , DELETE_NOTE , SET_EDIT_MODE , SET_NOTE_FOR_EDIT , UPDATE_NOTE } from './actions' ;
1010
1111function App ( ) {
1212const [ theme , setTheme ] = useState ( 'light' ) ;
@@ -15,20 +15,20 @@ function App() {
1515const [ state , dispatch ] = useReducer (
1616( state :StateType , action :{ type :string ; payload :any } ) => {
1717switch ( action . type ) {
18- case ' SET_EDIT_MODE' :
18+ case SET_EDIT_MODE :
1919return { ...state , editMode :action . payload } ;
20- case ' SET_NOTE_FOR_EDIT' :
20+ case SET_NOTE_FOR_EDIT :
2121return { ...state , noteToBeEdited :action . payload } ;
22- case ' ADD_NOTE' :
22+ case ADD_NOTE :
2323return { ...state , notes :[ action . payload , ...state . notes ] } ;
24- case ' DELETE_NOTE' :
24+ case DELETE_NOTE :
2525const index = state . notes . findIndex (
2626( note ) => note . id === action . payload
2727) ;
2828let editedNotes = [ ...state . notes ] ;
2929editedNotes . splice ( index , 1 ) ;
3030return { ...state , notes :editedNotes } ;
31- case ' UPDATE_NOTE' :
31+ case UPDATE_NOTE :
3232const indexUpdated = state . notes . findIndex (
3333( note ) => note . id === action . payload . id
3434) ;
@@ -49,7 +49,6 @@ function App() {
4949} else {
5050setTheme ( 'light' ) ;
5151}
52- console . log ( checked , check ) ;
5352} ;
5453
5554return (