Skip to content
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

fix: 更新使用者帳號資訊功能 #71

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/app/update-userinfo/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,19 @@ function UpdateUserInfo() {
const handleSubmit = async (event) => {
event.preventDefault();
try {
const response = await axios.post(
"/api/v1/account/users",
data,
{
const response = await axios.patch("/api/v1/account/users", data, {
headers: {
"Content-Type": "application/json;charset=UTF-8",
Authorization: `Bearer ${token}`,
}
);
},
});
console.log(name.length);
if (response.status === 200) {
setSuccessMessage(response.data.message);
setErrorMessage("");
Cookies.remove('token');
localStorage.removeItem("userInfo");
window.location.href = "/profile";
window.location.href = "/sign-up";
}
} catch (error) {
setErrorMessage(error.response.data.message);
Expand Down Expand Up @@ -107,7 +106,7 @@ function UpdateUserInfo() {
onChange={(e) => setName(e.target.value)}
/>
</Grid>
<Grid item xs={12}>
{/* <Grid item xs={12}>
<TextField
autoComplete="given-name"
value={username}
Expand All @@ -118,7 +117,7 @@ function UpdateUserInfo() {
autoFocus
onChange={(e) => setUsername(e.target.value)}
/>
</Grid>
</Grid> */}
<Grid item xs={12}>
<TextField
value={email}
Expand Down Expand Up @@ -156,4 +155,4 @@ function UpdateUserInfo() {
);
}

export default UpdateUserInfo;
export default UpdateUserInfo;