Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
ThaliApp
Commits
7e90de04
Commit
7e90de04
authored
Apr 19, 2017
by
Wietse Kuipers
Browse files
Linting fixes
parent
92412959
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/actions/calendar.js
View file @
7e90de04
...
...
@@ -3,7 +3,7 @@ import * as types from './actionTypes';
export
function
calendarRetrieved
(
eventList
)
{
return
{
type
:
types
.
CALENDARRETREIVED
,
eventList
:
eventList
eventList
,
};
}
...
...
@@ -13,13 +13,13 @@ export function calendarNotRetrieved() {
};
}
export
function
retrieveCalendar
(){
return
(
dispatch
)
=>
{
le
t
start
=
new
Date
().
toISOString
().
substring
(
0
,
10
);
export
function
retrieveCalendar
()
{
return
(
dispatch
)
=>
{
cons
t
start
=
new
Date
().
toISOString
().
substring
(
0
,
10
);
let
end
=
new
Date
();
end
.
setMonth
(
end
.
getMonth
()
+
6
);
end
=
end
.
toISOString
().
substring
(
0
,
10
);
return
fetch
(
'
http://localhost:8000/api/events?start=
'
+
start
+
'
&end=
'
+
end
)
return
fetch
(
`
http://localhost:8000/api/events?start=
${
start
}
&end=
${
end
}
`
)
.
then
(
response
=>
response
.
json
())
.
then
(
...
...
@@ -30,6 +30,6 @@ export function retrieveCalendar(){
.
catch
((
error
)
=>
{
console
.
log
(
error
);
dispatch
(
calendarNotRetrieved
());
})
};
}
\ No newline at end of file
});
};
}
app/components/Calendar.js
View file @
7e90de04
...
...
@@ -5,7 +5,7 @@ import * as actions from '../actions/calendar';
import
Event
from
'
./Event
'
;
const
Calendar
=
(
props
)
=>
{
if
(
!
props
.
calendarFetched
)
{
if
(
!
props
.
calendarFetched
)
{
props
.
retrieveCalendar
();
return
(
<
View
>
...
...
@@ -13,25 +13,24 @@ const Calendar = (props) => {
No
calendar
retrieved
!
<
/Text
>
<
/View
>
)
}
else
{
console
.
log
(
props
);
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
let
events
=
[];
for
(
let
i
=
0
;
i
<
props
.
eventList
.
length
;
i
++
)
{
events
.
push
(
Event
(
props
.
eventList
[
i
]));
}
const
dataSource
=
ds
.
cloneWithRows
(
events
);
return
(
<
View
>
<
ListView
dataSource
=
{
dataSource
}
renderRow
=
{(
rowData
)
=>
rowData
}
/
>
<
/View
>
);
}
console
.
log
(
props
);
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
const
events
=
[];
for
(
let
i
=
0
;
i
<
props
.
eventList
.
length
;
i
++
)
{
events
.
push
(
Event
(
props
.
eventList
[
i
]));
}
const
dataSource
=
ds
.
cloneWithRows
(
events
);
return
(
<
View
>
<
ListView
dataSource
=
{
dataSource
}
renderRow
=
{
rowData
=>
rowData
}
/
>
<
/View
>
);
};
const
mapStateToProps
=
state
=>
state
.
calendar
;
...
...
app/components/Event.js
View file @
7e90de04
import
React
from
'
react
'
;
import
{
View
,
Text
}
from
'
react-native
'
;
const
Event
=
(
event
)
=>
const
Event
=
event
=>
<
View
>
<
Text
>
<
b
>
{
event
.
title
}
<
/b> </
Text
>
<
Text
>
{
new
Date
(
event
.
start
).
toISOString
().
substring
(
0
,
10
)}
<
/Text
>
...
...
@@ -10,4 +10,4 @@ const Event = (event) =>
<
/View
>
;
export
default
Event
;
\ No newline at end of file
export
default
Event
;
app/reducers/calendar.js
View file @
7e90de04
import
*
as
types
from
'
../actions/actionTypes
'
;
const
initialState
=
{
eventList
:
''
,
eventList
:
''
,
calendarFetched
:
false
,
};
export
default
function
calendar
(
state
=
initialState
,
action
=
{})
{
switch
(
action
.
type
)
{
case
types
.
CALENDARRETREIVED
:
return
{
...
state
,
eventList
:
action
.
eventList
,
calendarFetched
:
true
};
return
{
...
state
,
eventList
:
action
.
eventList
,
calendarFetched
:
true
};
case
types
.
CALENDARERROR
:
return
{
...
state
,
calendarFetched
:
true
};
return
{
...
state
,
calendarFetched
:
true
};
default
:
return
{
...
state
};
}
...
...
app/reducers/index.js
View file @
7e90de04
import
login
from
'
./login
'
;
import
navigation
from
'
./navigation
'
;
import
calendar
from
'
./calendar
'
import
calendar
from
'
./calendar
'
;
export
{
login
,
...
...
app/reducers/login.js
View file @
7e90de04
import
*
as
types
from
'
../actions/actionTypes
'
;
import
*
as
console
from
"
react-native
"
;
import
*
as
console
from
'
react-native
'
;
const
initialState
=
{
loginState
:
''
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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