-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Profile page integrate API #401
Conversation
Codecov Report
@@ Coverage Diff @@
## master #401 +/- ##
=======================================
Coverage 18.09% 18.09%
=======================================
Files 86 86
Lines 1343 1343
Branches 270 270
=======================================
Hits 243 243
Misses 1050 1050
Partials 50 50 Continue to review full report at Codecov.
|
@@ -240,7 +240,7 @@ export default class Users extends Component { | |||
onCancel={userStore.hideModal} | |||
hideFooter | |||
> | |||
<form className="formContent" onSubmit={userStore.createOrModify} method="post"> | |||
<form className="formContent" onSubmit={e => userStore.createOrModify(e)} method="post"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change for prevent page refresh。
createOrModify = async e => {
e.preventDefault();
...
}
server/routes/api.js
Outdated
scope: '', | ||
refresh_token: refresh_token | ||
}); | ||
const res = await agent.post([apiServer, 'oauth2/token'].join('/')).send({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agent.post(url, {...})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, define url variable
constructor(props) { | ||
super(props); | ||
this.state = { | ||
currentForm: 'basic' | ||
}; | ||
} | ||
|
||
componentDidMount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this logic in onEnter
, or SSR will not work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If put in onEnter ,refresh page getCookie method will error .
src/pages/Profile/index.jsx
Outdated
const { userDetail, changeUser, changeUserRole } = userStore; | ||
const { userDetail, changeUser, modifyUser } = userStore; | ||
const emailRegexp = | ||
"[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)[\\w](?:[\\w-]*[\\w])?"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regExp is too complex ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
|
||
return ( | ||
<div className={styles.form}> | ||
<form className={styles.form} onSubmit={e => modifyUser(e)} method="post"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to pass event to onSubmit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change for prevent page refresh when submit
fix: #348 |
No description provided.