Skip to content

Commit 878f5d6

Browse files
committed
update profile
1 parent 75aa14c commit 878f5d6

File tree

23 files changed

+1017
-436
lines changed

23 files changed

+1017
-436
lines changed

api/Auth/checkUsername.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import axios, { AxiosError } from "axios";
33

44
export async function checkUsername(username: string) {
55
let data = JSON.stringify({
6-
user_name: username,
6+
username: username,
77
});
88
let config = {
99
method: "post",

api/user/getAvatar.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { API_URL } from "@/config/config";
22
import axios from "axios";
33

4-
export async function GetAvatarFromServerSide(cookies: string) {
4+
export async function GetAvatarFromServerSide(user_id: string) {
55
let config = {
66
method: "get",
77
maxBodyLength: Infinity,
8-
url: API_URL + "/user/avatar",
8+
url: API_URL + `/user/avatar/${user_id}`,
99
headers: {
1010
"Content-Type": "application/json",
11-
Cookie: cookies,
1211
},
1312
validateStatus: function () {
1413
return true;

api/user/profile/getUserDetil.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { API_URL } from "@/config/config";
2+
import axios from "axios";
3+
4+
export async function GetUserDetil(accessToken: string) {
5+
let config = {
6+
method: "get",
7+
maxBodyLength: Infinity,
8+
url: API_URL + "/user/setting/detil",
9+
headers: {
10+
"Content-Type": "application/json",
11+
Cookie: accessToken,
12+
},
13+
validateStatus: function () {
14+
return true;
15+
},
16+
};
17+
return await axios.request(config);
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { API_URL } from "@/config/config";
2+
import axios from "axios";
3+
4+
export async function UpdateUserAllName(
5+
username: string,
6+
display_name: string,
7+
) {
8+
let data = JSON.stringify({
9+
username: username,
10+
display_name: display_name,
11+
});
12+
let config = {
13+
method: "post",
14+
maxBodyLength: Infinity,
15+
url: API_URL + "/user/setting/resetall/name",
16+
headers: {
17+
"Content-Type": "application/json",
18+
},
19+
data: data,
20+
validateStatus: function () {
21+
return true;
22+
},
23+
};
24+
return await axios.request(config);
25+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { API_URL } from "@/config/config";
2+
import axios from "axios";
3+
4+
export async function UpdateUserDisplayName(
5+
display_name: string,
6+
) {
7+
let data = JSON.stringify({
8+
display_name: display_name,
9+
});
10+
let config = {
11+
method: "post",
12+
maxBodyLength: Infinity,
13+
url: API_URL + "/user/setting/reset/displayname",
14+
headers: {
15+
"Content-Type": "application/json",
16+
},
17+
data: data,
18+
validateStatus: function () {
19+
return true;
20+
},
21+
};
22+
return await axios.request(config);
23+
}

api/user/profile/updateUsername.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { API_URL } from "@/config/config";
2+
import axios from "axios";
3+
4+
export async function UpdateUsername(
5+
username: string,
6+
) {
7+
let data = JSON.stringify({
8+
username: username,
9+
});
10+
let config = {
11+
method: "post",
12+
maxBodyLength: Infinity,
13+
url: API_URL + "/user/setting/reset/username",
14+
headers: {
15+
"Content-Type": "application/json",
16+
},
17+
data: data,
18+
validateStatus: function () {
19+
return true;
20+
},
21+
};
22+
return await axios.request(config);
23+
}

app/[locale]/user/profile/page.tsx

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Profile } from "@/components/user/profile/profileGetData";
2+
import { useTranslations } from "next-intl";
3+
4+
export default function UserProfileSetting() {
5+
const t = useTranslations("UserProfileSetting");
6+
const userProfileSettingTranslate = {
7+
invalidUsername: t("invalidUsername"),
8+
usernameHasBeenUse: t("usernameHasBeenUse"),
9+
pleaseEnterAUsername: t("pleaseEnterAUsername"),
10+
errorWhenUpdateUserAllNameTitle: t("errorWhenUpdateUserAllNameTitle"),
11+
errorWhenUpdateUserAllName: t("errorWhenUpdateUserAllName"),
12+
SuccessfulUpdateUserAllNameTitle: t("SuccessfulUpdateUserAllNameTitle")
13+
};
14+
return <Profile t={userProfileSettingTranslate}></Profile>;
15+
}

app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22
import "@mantine/core/styles.css";
3-
import '@mantine/notifications/styles.css';
3+
import "@mantine/notifications/styles.css";
44
import {
55
MantineProvider,
66
ColorSchemeScript,
@@ -29,7 +29,7 @@ export default function RootLayout({
2929
>
3030
<ModalsProvider>
3131
{children}
32-
<Notifications />
32+
<Notifications position="bottom-center" />
3333
</ModalsProvider>
3434
</MantineProvider>
3535
</body>

0 commit comments

Comments
 (0)