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
57495259
Commit
57495259
authored
Mar 19, 2021
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lint and remove unused code
parent
a97263cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
34 deletions
+31
-34
src/redux/studio.js
src/redux/studio.js
+25
-25
src/views/studio/lib/fetchers.js
src/views/studio/lib/fetchers.js
+0
-4
src/views/studio/studio-info.jsx
src/views/studio/studio-info.jsx
+6
-5
No files found.
src/redux/studio.js
View file @
57495259
...
@@ -32,26 +32,26 @@ const studioReducer = (state, action) => {
...
@@ -32,26 +32,26 @@ const studioReducer = (state, action) => {
}
}
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
'
SET_INFO
'
:
case
'
SET_INFO
'
:
return
{
return
{
...
state
,
...
state
,
...
action
.
info
...
action
.
info
};
};
case
'
SET_ROLES
'
:
case
'
SET_ROLES
'
:
return
{
return
{
...
state
,
...
state
,
...
action
.
roles
...
action
.
roles
};
};
case
'
SET_FETCH_STATUS
'
:
case
'
SET_FETCH_STATUS
'
:
if
(
action
.
error
)
{
if
(
action
.
error
)
{
log
.
error
(
action
.
error
);
log
.
error
(
action
.
error
);
}
}
return
{
return
{
...
state
,
...
state
,
[
action
.
fetchType
]:
action
.
fetchStatus
[
action
.
fetchType
]:
action
.
fetchStatus
};
};
default
:
default
:
return
state
;
return
state
;
}
}
};
};
...
@@ -62,19 +62,19 @@ const setFetchStatus = (fetchType, fetchStatus, error) => ({
...
@@ -62,19 +62,19 @@ const setFetchStatus = (fetchType, fetchStatus, error) => ({
error
error
});
});
const
setInfo
=
(
info
)
=>
({
const
setInfo
=
info
=>
({
type
:
'
SET_INFO
'
,
type
:
'
SET_INFO
'
,
info
:
info
info
:
info
});
});
const
setRoles
=
(
roles
)
=>
({
const
setRoles
=
roles
=>
({
type
:
'
SET_ROLES
'
,
type
:
'
SET_ROLES
'
,
roles
:
roles
roles
:
roles
});
});
const
getInfo
=
(
studioId
)
=>
(
dispatch
=>
{
const
getInfo
=
studioId
=>
(
dispatch
=>
{
dispatch
(
setFetchStatus
(
'
infoStatus
'
,
Status
.
FETCHING
));
dispatch
(
setFetchStatus
(
'
infoStatus
'
,
Status
.
FETCHING
));
api
({
uri
:
`/studios/
${
studioId
}
`
,
},
(
err
,
body
,
res
)
=>
{
api
({
uri
:
`/studios/
${
studioId
}
`
},
(
err
,
body
,
res
)
=>
{
if
(
err
||
typeof
body
===
'
undefined
'
||
res
.
statusCode
!==
200
)
{
if
(
err
||
typeof
body
===
'
undefined
'
||
res
.
statusCode
!==
200
)
{
dispatch
(
setFetchStatus
(
'
infoStatus
'
,
Status
.
ERROR
,
err
));
dispatch
(
setFetchStatus
(
'
infoStatus
'
,
Status
.
ERROR
,
err
));
return
;
return
;
...
@@ -117,4 +117,4 @@ module.exports = {
...
@@ -117,4 +117,4 @@ module.exports = {
Status
,
Status
,
getInfo
,
getInfo
,
getRoles
getRoles
}
}
;
src/views/studio/lib/fetchers.js
View file @
57495259
const
ITEM_LIMIT
=
4
;
const
ITEM_LIMIT
=
4
;
const
infoFetcher
=
studioId
=>
fetch
(
`
${
process
.
env
.
API_HOST
}
/studios/
${
studioId
}
`
)
.
then
(
response
=>
response
.
json
());
const
projectFetcher
=
(
studioId
,
offset
)
=>
const
projectFetcher
=
(
studioId
,
offset
)
=>
fetch
(
`
${
process
.
env
.
API_HOST
}
/studios/
${
studioId
}
/projects?limit=
${
ITEM_LIMIT
}
&offset=
${
offset
}
`
)
fetch
(
`
${
process
.
env
.
API_HOST
}
/studios/
${
studioId
}
/projects?limit=
${
ITEM_LIMIT
}
&offset=
${
offset
}
`
)
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
response
.
json
())
...
@@ -25,7 +22,6 @@ const activityFetcher = studioId =>
...
@@ -25,7 +22,6 @@ const activityFetcher = studioId =>
export
{
export
{
activityFetcher
,
activityFetcher
,
infoFetcher
,
projectFetcher
,
projectFetcher
,
curatorFetcher
,
curatorFetcher
,
managerFetcher
managerFetcher
...
...
src/views/studio/studio-info.jsx
View file @
57495259
...
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
...
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import
{
useParams
}
from
'
react-router-dom
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
connect
}
from
'
react-redux
'
;
import
Debug
from
'
./debug.jsx
'
;
import
Debug
from
'
./debug.jsx
'
;
import
{
Status
as
SessionStatus
}
from
'
../../redux/session
'
;
import
{
getInfo
,
getRoles
}
from
'
../../redux/studio
'
;
import
{
getInfo
,
getRoles
}
from
'
../../redux/studio
'
;
const
StudioInfo
=
({
username
,
studio
,
token
,
onLoadInfo
,
onLoadRoles
})
=>
{
const
StudioInfo
=
({
username
,
studio
,
token
,
onLoadInfo
,
onLoadRoles
})
=>
{
...
@@ -33,11 +32,13 @@ StudioInfo.propTypes = {
...
@@ -33,11 +32,13 @@ StudioInfo.propTypes = {
token
:
PropTypes
.
string
,
token
:
PropTypes
.
string
,
studio
:
PropTypes
.
shape
({
studio
:
PropTypes
.
shape
({
// Fill this in as the data is used, just for demo now
// Fill this in as the data is used, just for demo now
})
}),
onLoadInfo
:
PropTypes
.
func
,
onLoadRoles
:
PropTypes
.
func
};
};
export
default
connect
(
export
default
connect
(
(
state
)
=>
{
state
=>
{
const
user
=
state
.
session
.
session
.
user
;
const
user
=
state
.
session
.
session
.
user
;
return
{
return
{
studio
:
state
.
studio
,
studio
:
state
.
studio
,
...
@@ -45,8 +46,8 @@ export default connect(
...
@@ -45,8 +46,8 @@ export default connect(
token
:
user
&&
user
.
token
token
:
user
&&
user
.
token
};
};
},
},
(
dispatch
)
=>
({
dispatch
=>
({
onLoadInfo
:
(
studioId
)
=>
dispatch
(
getInfo
(
studioId
)),
onLoadInfo
:
studioId
=>
dispatch
(
getInfo
(
studioId
)),
onLoadRoles
:
(
studioId
,
username
,
token
)
=>
dispatch
(
onLoadRoles
:
(
studioId
,
username
,
token
)
=>
dispatch
(
getRoles
(
studioId
,
username
,
token
))
getRoles
(
studioId
,
username
,
token
))
})
})
...
...
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