Skip to content

Commit

Permalink
Merge pull request #71 from Shih-Hsuan/development
Browse files Browse the repository at this point in the history
fix: 更新使用者帳號資訊功能
  • Loading branch information
keke125 authored Dec 26, 2023
2 parents fa54c23 + d82ca9e commit a915095
Showing 1 changed file with 9 additions and 10 deletions.
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;

0 comments on commit a915095

Please sign in to comment.