Skip to content

Commit

Permalink
#: Modify PaginationModel
Browse files Browse the repository at this point in the history
  • Loading branch information
zdu-strong committed Jan 18, 2025
1 parent 9538360 commit e8b29a0
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion capacitor/src/api/Git.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import axios from "axios";
import { TypedJSON } from "typedjson";

export async function getServerGitInfo() {
const { data } = await axios.get<GitPropertiesModel>("/git");
const { data } = await axios.get("/git");
return new TypedJSON(GitPropertiesModel).parse(data)!;
}
2 changes: 2 additions & 0 deletions capacitor/src/model/PaginationMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class PaginationModel<T> {

list!: T[];

constructor();

constructor(
pageNum: number,
pageSize: number,
Expand Down
2 changes: 1 addition & 1 deletion electron/src/api/Git.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import axios from "axios";
import { TypedJSON } from "typedjson";

export async function getServerGitInfo() {
const { data } = await axios.get<GitPropertiesModel>("/git");
const { data } = await axios.get("/git");
return new TypedJSON(GitPropertiesModel).parse(data)!;
}
2 changes: 2 additions & 0 deletions electron/src/model/PaginationMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class PaginationModel<T> {

list!: T[];

constructor();

constructor(
pageNum: number,
pageSize: number,
Expand Down
10 changes: 5 additions & 5 deletions react/src/api/Authorization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ import axios from "axios";
import { TypedJSON } from "typedjson";

export async function signUp(password: string, nickname: string, userEmailList: UserEmailModel[]): Promise<void> {
let { data: user } = await axios.post<UserModel>(`/sign_up`, {
const { data } = await axios.post(`/sign_up`, {
username: nickname,
password: password,
userEmailList: userEmailList,
});
user = new TypedJSON(UserModel).parse(user)!;
const user = new TypedJSON(UserModel).parse(data)!;
user.menuOpen = true;
await signOut();
await setGlobalUserInfo(user);
}

export async function sendVerificationCode(email: string) {
const { data } = await axios.post<VerificationCodeEmailModel>("/email/send_verification_code", null, { params: { email } });
const { data } = await axios.post("/email/send_verification_code", null, { params: { email } });
return new TypedJSON(VerificationCodeEmailModel).parse(data)!;
}

export async function signIn(username: string, password: string): Promise<void> {
await signOut();
let { data: user } = await axios.post<UserModel>(`/sign_in/one_time_password`, null, {
const { data } = await axios.post(`/sign_in/one_time_password`, null, {
params: {
username: username,
password: await encryptByPublicKeyOfRSA(password, await getKeyOfRSAPublicKey()),
}
});
user = new TypedJSON(UserModel).parse(user)!;
const user = new TypedJSON(UserModel).parse(data)!;
user.menuOpen = true;
await setGlobalUserInfo(user);
}
Expand Down
6 changes: 3 additions & 3 deletions react/src/api/Friendship.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export async function deleteFromBlacklist(friendId: string) {
}

export async function getFriendList() {
const { data } = await axios.get<FriendshipPaginationModel>("/friendship/get_friend_list", { params: { pageNum: 1, pageSize: 100 } });
const { data } = await axios.get("/friendship/get_friend_list", { params: { pageNum: 1, pageSize: 100 } });
return new TypedJSON(FriendshipPaginationModel).parse(data)!;
}

export async function getStrangerList() {
const { data } = await axios.get<FriendshipPaginationModel>("/friendship/get_stranger_list", { params: { pageNum: 1, pageSize: 100 } });
const { data } = await axios.get("/friendship/get_stranger_list", { params: { pageNum: 1, pageSize: 100 } });
return new TypedJSON(FriendshipPaginationModel).parse(data)!;
}

export async function getFriendship(friendId: string) {
const { data } = await axios.get<FriendshipModel>("/friendship/get_friendship", { params: { friendId } });
const { data } = await axios.get("/friendship/get_friendship", { params: { friendId } });
return new TypedJSON(FriendshipModel).parse(data)!;
}
2 changes: 1 addition & 1 deletion react/src/api/Git.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import axios from "axios";
import { TypedJSON } from "typedjson";

export async function getServerGitInfo() {
const { data } = await axios.get<GitPropertiesModel>("/git");
const { data } = await axios.get("/git");
return new TypedJSON(GitPropertiesModel).parse(data)!;
}
5 changes: 2 additions & 3 deletions react/src/api/SuperAdminUserQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import axios from "axios";
import { TypedJSON } from "typedjson";

export async function searchByPagination() {
let { data: paginationModel } = await axios.get<UserPaginationModel>("/super_admin/user/search/pagination", { params: { pageNum: 1, pageSize: 100 } });
paginationModel = new TypedJSON(UserPaginationModel).parse(paginationModel)!;
return paginationModel;
const { data } = await axios.get("/super_admin/user/search/pagination", { params: { pageNum: 1, pageSize: 100 } });
return new TypedJSON(UserPaginationModel).parse(data)!;
}
5 changes: 2 additions & 3 deletions react/src/api/SuperAdminUserRoleQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import axios from "axios";
import { TypedJSON } from "typedjson";

export async function searchByPagination() {
let { data: paginationModel } = await axios.get<SystemRolePaginationModel>("/super_admin/user_role/search/pagination", { params: { pageNum: 1, pageSize: 100 } });
paginationModel = new TypedJSON(SystemRolePaginationModel).parse(paginationModel)!;
return paginationModel;
const { data } = await axios.get("/super_admin/user_role/search/pagination", { params: { pageNum: 1, pageSize: 100 } });
return new TypedJSON(SystemRolePaginationModel).parse(data)!;
}
5 changes: 2 additions & 3 deletions react/src/api/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import axios from "axios";
import { TypedJSON } from "typedjson";

export async function getUserById(userId: string) {
let { data: user } = await axios.get<UserModel>("/user", { params: { id: userId } });
user = new TypedJSON(UserModel).parse(user)!;
return user;
const { data } = await axios.get("/user", { params: { id: userId } });
return new TypedJSON(UserModel).parse(data)!;
}
2 changes: 1 addition & 1 deletion react/src/api/UserMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function sendMessage(body: {
content?: string,
url?: string,
}) {
const { data } = await axios.post<UserMessageModel>("/user_message/send", { content: body.content, url: body.url });
const { data } = await axios.post("/user_message/send", { content: body.content, url: body.url });
return new TypedJSON(UserMessageModel).parse(data)!;
}

Expand Down
2 changes: 2 additions & 0 deletions react/src/model/PaginationModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class PaginationModel<T> {

list!: T[];

constructor();

constructor(
pageNum: number,
pageSize: number,
Expand Down

0 comments on commit e8b29a0

Please sign in to comment.