Skip to content

Commit

Permalink
userinfo change bug
Browse files Browse the repository at this point in the history
  • Loading branch information
y123ob committed Jun 19, 2019
1 parent b5eaaf7 commit 7607944
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
5 changes: 4 additions & 1 deletion backend/src/dutch_broomstick/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def update(self, instance, validated_data):

instance.save()

Profile.objects.update_or_create(user=instance, **profile_data)
profile = Profile.objects.get(user=instance)
profile.default_account = profile_data.get('default_account', profile.default_account)
profile.default_nickname = profile_data.get('default_nickname', profile.default_nickname)
profile.save()
return instance


Expand Down
7 changes: 2 additions & 5 deletions frontend/src/components/pages/AccountPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import { CopyToClipboard } from 'react-copy-to-clipboard';
const AccountPage = ({ match, roomname, sendlist, members }) => {
const to = match.params.to
const toname = to
console.log(toname)
console.log(sendlist)
const edge = sendlist.find(m=> m.to == toname)
console.log(edge)
const member = members.find(m=> m.membername == toname)
console.log(member)
console.log(members)
const money = edge.label
const account = member.account
console.log(account)
Expand All @@ -30,7 +27,7 @@ const AccountPage = ({ match, roomname, sendlist, members }) => {
</Block>

<CopyToClipboard
text={`${account} ${toname}`}
text={`${account} ${toname} ${money}`}
onCopy={() => { }}>
<span>
<Button>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/containers/UserInfoForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export default connect(mapStateToProps)(
reduxForm({
form: 'UserInfoChange',
onSubmit(values, dispatch, props) {
dispatch(userInfoChangeRequest(values.password, values.name, values.account, props.username, props.token))
dispatch(userInfoChangeRequest(values.password, values.default_nickname, values.default_account, props.username, props.token))
console.log(values)
}
})(UserInfoFormContainer)
)
Expand Down
1 change: 1 addition & 0 deletions frontend/src/store/user/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function* watchUserSignUpRequest() {
function* userInfoChangeRequest({ username, password, default_nickname, default_account, token }) {
console.log(token)
try{
console.log(username , password, default_nickname, default_account)
const response = yield api.put(`/users/${username}/`, { username, password, default_nickname, default_account }, { token })
yield put(userInfoChangeSuccess(password, default_nickname, default_account))
} catch (e){
Expand Down

0 comments on commit 7607944

Please sign in to comment.