chore: prefer ??

This commit is contained in:
Paul Pan 2024-01-30 10:50:32 +08:00
parent 1d93812899
commit 13c4c9a5a1
2 changed files with 8 additions and 8 deletions

View File

@ -87,14 +87,14 @@ export default function StatusTable(props: StatusTableProps) {
},
) => {
try {
const cur = params.current || 1;
const size = params.pageSize || 10;
const cur = params.current ?? 1;
const size = params.pageSize ?? 10;
const res = await StatusApi.Query(
{
pid: props.pid,
uid: props.uid,
offset: (cur - 1) * (size || 10),
offset: (cur - 1) * size,
limit: size,
},
props.token,

View File

@ -73,13 +73,13 @@ export default function SearchPage() {
},
) => {
try {
const cur = params.current || 1;
const size = params.pageSize || 10;
const cur = params.current ?? 1;
const size = params.pageSize ?? 10;
const info = await ProblemApi.Search({
keyword: params.title || "",
tag: params.tags || "",
offset: (cur - 1) * (size || 10),
keyword: params.title ?? "",
tag: params.tags ?? "",
offset: (cur - 1) * size,
limit: size,
});
const data = info.data.map((i) => {