Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
60f0ee1d
Commit
60f0ee1d
authored
Sep 12, 2016
by
Ray Schamp
Committed by
GitHub
Sep 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #913 from rschamp/bugfix/empty-bodies
Don't set state to undefined API response bodies
parents
bd911c52
c0eb1608
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
src/views/splash/splash.jsx
src/views/splash/splash.jsx
+12
-5
No files found.
src/views/splash/splash.jsx
View file @
60f0ee1d
...
...
@@ -4,6 +4,7 @@ var omit = require('lodash.omit');
var
React
=
require
(
'
react
'
);
var
api
=
require
(
'
../../lib/api
'
);
var
log
=
require
(
'
../../lib/log
'
);
var
render
=
require
(
'
../../lib/render.jsx
'
);
var
sessionActions
=
require
(
'
../../redux/session.js
'
);
var
shuffle
=
require
(
'
../../lib/shuffle.js
'
).
shuffle
;
...
...
@@ -94,35 +95,40 @@ var Splash = injectIntl(React.createClass({
api
({
uri
:
'
/proxy/users/
'
+
this
.
props
.
session
.
session
.
user
.
username
+
'
/activity?limit=5
'
},
function
(
err
,
body
)
{
if
(
!
err
)
this
.
setState
({
activity
:
body
});
if
(
!
body
)
return
log
.
error
(
'
No response body
'
);
if
(
!
err
)
return
this
.
setState
({
activity
:
body
});
}.
bind
(
this
));
},
getFeaturedGlobal
:
function
()
{
api
({
uri
:
'
/proxy/featured
'
},
function
(
err
,
body
)
{
if
(
!
err
)
this
.
setState
({
featuredGlobal
:
body
});
if
(
!
body
)
return
log
.
error
(
'
No response body
'
);
if
(
!
err
)
return
this
.
setState
({
featuredGlobal
:
body
});
}.
bind
(
this
));
},
getFeaturedCustom
:
function
()
{
api
({
uri
:
'
/proxy/users/
'
+
this
.
props
.
session
.
session
.
user
.
id
+
'
/featured
'
},
function
(
err
,
body
)
{
if
(
!
err
)
this
.
setState
({
featuredCustom
:
body
});
if
(
!
body
)
return
log
.
error
(
'
No response body
'
);
if
(
!
err
)
return
this
.
setState
({
featuredCustom
:
body
});
}.
bind
(
this
));
},
getNews
:
function
()
{
api
({
uri
:
'
/news?limit=3
'
},
function
(
err
,
body
)
{
if
(
!
err
)
this
.
setState
({
news
:
body
});
if
(
!
body
)
return
log
.
error
(
'
No response body
'
);
if
(
!
err
)
return
this
.
setState
({
news
:
body
});
}.
bind
(
this
));
},
getProjectCount
:
function
()
{
api
({
uri
:
'
/projects/count/all
'
},
function
(
err
,
body
)
{
if
(
!
err
)
this
.
setState
({
projectCount
:
body
.
count
});
if
(
!
body
)
return
log
.
error
(
'
No response body
'
);
if
(
!
err
)
return
this
.
setState
({
projectCount
:
body
.
count
});
}.
bind
(
this
));
},
refreshHomepageCache
:
function
()
{
...
...
@@ -133,6 +139,7 @@ var Splash = injectIntl(React.createClass({
useCsrf
:
true
},
function
(
err
,
body
)
{
if
(
err
)
return
this
.
setState
({
refreshCacheStatus
:
'
fail
'
});
if
(
!
body
)
return
log
.
error
(
'
No response body
'
);
if
(
!
body
.
success
)
return
this
.
setState
({
refreshCacheStatus
:
'
inprogress
'
});
return
this
.
setState
({
refreshCacheStatus
:
'
pass
'
});
}.
bind
(
this
));
...
...
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