Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
pill_minder
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Phuengton Chummuel
pill_minder
Commits
8225be47
Commit
8225be47
authored
Mar 21, 2018
by
Phuengton Chummuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add redux reducers
parent
fd0d4343
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
1 deletion
+72
-1
appointmentReducer.js
src/reducers/appointmentReducer.js
+34
-0
index.js
src/reducers/index.js
+5
-1
reminderReducer.js
src/reducers/reminderReducer.js
+33
-0
No files found.
src/reducers/appointmentReducer.js
0 → 100644
View file @
8225be47
import
{
APPOINTMENT_FETCH
,
APPOINTMENT_CREATE
,
APPOINTMENT_UPDATE
,
APPOINTMENT_DELETE
,
}
from
'./../actions/types'
import
{
Alert
}
from
'react-native'
import
{
ToastAndroid
}
from
'react-native'
;
const
INITIAL_STATE
=
{
appointments
:
[]
}
export
default
(
state
=
INITIAL_STATE
,
action
)
=>
{
switch
(
action
.
type
)
{
case
APPOINTMENT_CREATE
:
state
=
Object
.
assign
([],
state
,
{
appointments
:
action
.
payload
})
return
state
;
case
APPOINTMENT_FETCH
:
state
=
Object
.
assign
([],
state
,
{
appointments
:
action
.
payload
});
return
state
;
case
APPOINTMENT_UPDATE
:
state
=
Object
.
assign
([],
state
,
{
appointments
:
action
.
payload
});
return
state
;
case
APPOINTMENT_DELETE
:
state
=
Object
.
assign
([],
state
,
{
appointments
:
action
.
payload
});
return
state
;
default
:
return
state
}
}
src/reducers/index.js
View file @
8225be47
import
{
combineReducers
}
from
'redux'
import
appointmentReducer
from
'./appointmentReducer'
import
reminderReducer
from
'./reminderReducer'
export
default
combineReducers
({
libraries
:
()
=>
[]
appointments
:
appointmentReducer
,
reminders
:
reminderReducer
});
\ No newline at end of file
src/reducers/reminderReducer.js
0 → 100644
View file @
8225be47
import
{
REMINDER_FETCH
,
REMINDER_CREATE
,
REMINDER_UPDATE
,
REMINDER_DELETE
,
}
from
'./../actions/types'
import
{
ToastAndroid
}
from
'react-native'
;
const
INITIAL_STATE
=
{
reminders
:
[]
}
export
default
(
state
=
INITIAL_STATE
,
action
)
=>
{
switch
(
action
.
type
)
{
case
REMINDER_CREATE
:
state
=
Object
.
assign
([],
state
,
{
reminders
:
action
.
payload
})
return
state
;
case
REMINDER_FETCH
:
state
=
Object
.
assign
([],
state
,
{
reminders
:
action
.
payload
});
return
state
;
case
REMINDER_UPDATE
:
state
=
Object
.
assign
([],
state
,
{
reminders
:
action
.
payload
});
return
state
;
case
REMINDER_DELETE
:
state
=
Object
.
assign
([],
state
,
{
reminders
:
action
.
payload
});
return
state
;
default
:
return
state
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment