Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
My SU
frontend
Commits
bce15abd
Commit
bce15abd
authored
Jan 06, 2021
by
TJHeeringa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed weird behavior after update of membertypes
parent
c6219c4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
src/App/Pages/Association/AssociationMembertypes.js
src/App/Pages/Association/AssociationMembertypes.js
+5
-3
No files found.
src/App/Pages/Association/AssociationMembertypes.js
View file @
bce15abd
...
...
@@ -211,10 +211,12 @@ export const AssociationMembertypes = ({ association }) => {
const
[
membertypes
,
setMembertypes
]
=
useState
([]);
console
.
log
(
membertypes
);
const
getAssociationMembertypes
=
()
=>
{
API
.
callv4
({
url
:
"
/membertypes
"
,
queryParams
:
{
ordering
:
"
name
"
,
association__slug
:
association
.
slug
},
queryParams
:
{
association__slug
:
association
.
slug
},
method
:
"
GET
"
,
on_succes
:
(
response
)
=>
{
setMembertypes
(
response
.
results
);
...
...
@@ -226,11 +228,11 @@ export const AssociationMembertypes = ({ association }) => {
};
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect
(
()
=>
getAssociationMembertypes
()
,
[
"
on mount only
"
]);
useEffect
(
getAssociationMembertypes
,
[
"
on mount only
"
]);
const
addMembertype
=
(
membertype
)
=>
setMembertypes
(
prevState
=>
prevState
.
concat
(
membertype
));
const
editMembertype
=
(
edited_membertype
)
=>
setMembertypes
(
prevState
=>
prevState
.
map
(
membertype
=>
membertype
.
slug
===
edited_membertype
.
slug
?
edited_membertype
:
membertype
)
prevState
.
map
(
membertype
=>
membertype
.
url
===
edited_membertype
.
url
?
edited_membertype
:
membertype
)
);
return
(
...
...
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