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 { try {
const cur = params.current || 1; const cur = params.current ?? 1;
const size = params.pageSize || 10; const size = params.pageSize ?? 10;
const res = await StatusApi.Query( const res = await StatusApi.Query(
{ {
pid: props.pid, pid: props.pid,
uid: props.uid, uid: props.uid,
offset: (cur - 1) * (size || 10), offset: (cur - 1) * size,
limit: size, limit: size,
}, },
props.token, props.token,

View File

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