diff --git a/models/Base/File.ts b/models/Base/File.ts index 0489844..2dced4a 100644 --- a/models/Base/File.ts +++ b/models/Base/File.ts @@ -26,11 +26,12 @@ export class AzureFileModel extends FileModel { const { status, title, detail } = data as unknown as ErrorBaseData; - throw new HTTPError( - detail || title, - { method, path: fullPath, headers, body }, - { status, statusText: title, headers: header, body: data }, - ); + throw new HTTPError(detail || title, { + status, + statusText: title, + headers: header, + body: data, + }); } @toggle('uploading') diff --git a/models/Git.ts b/models/Git.ts index cbd4327..74d2fa0 100644 --- a/models/Git.ts +++ b/models/Git.ts @@ -75,9 +75,13 @@ export class SourceRepositoryModel extends RepositoryModel { .uniqueBy() .slice((page - 1) * per_page, page * per_page); - const pageData = await Promise.all( - list.map(full_name => this.getOne(full_name, relation)), - ); + const pageData: Awaited>[] = []; + + for (const full_name of list) { + const item = await this.getOne(full_name, relation); + + pageData.push(item); + } return { pageData, totalCount: list.length }; } } diff --git a/package.json b/package.json index 60d81be..032bafc 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "echarts-jsx": "^0.5.4", "idea-react": "^2.0.0-rc.2", "jsonwebtoken": "^9.0.2", - "koajax": "^2.0.0", + "koajax": "^1.1.2", "leaflet": "^1.9.4", "leaflet.chinatmsproviders": "^3.0.6", "mobx": "^6.13.1", diff --git a/pages/_app.tsx b/pages/_app.tsx index d7ea6e1..eaa2dea 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -20,9 +20,9 @@ enableStaticRendering(isServer()); const { t } = i18n; globalThis.addEventListener?.('unhandledrejection', ({ reason }) => { - const { message, response } = (reason || {}) as HTTPError; + const { message, body } = (reason || {}) as HTTPError; - const tips = response.body?.detail || message; + const tips = body?.detail || message; if (tips) alert(tips); }); diff --git a/pages/api/core.ts b/pages/api/core.ts index 523a2d2..72f3d6b 100644 --- a/pages/api/core.ts +++ b/pages/api/core.ts @@ -26,8 +26,7 @@ export function safeAPI(handler: NextAPI): NextAPI { console.error(error); return res.end(error); } - const { message, response } = error; - let { status, body } = response; + let { message, status, body } = error; res.status(status); res.statusMessage = message; diff --git a/pages/open-source.tsx b/pages/open-source.tsx index afa48fa..0e769c2 100644 --- a/pages/open-source.tsx +++ b/pages/open-source.tsx @@ -3,7 +3,7 @@ import { Contributor, GitRepository } from 'mobx-github'; import { observer } from 'mobx-react'; import { cache, compose, translator } from 'next-ssr-middleware'; import { FC } from 'react'; -import { Container } from 'react-bootstrap'; +import { Col, Container, Row } from 'react-bootstrap'; import { GitCard, SimpleRepository } from '../components/Git/Card'; import { PageHead } from '../components/layout/PageHead'; @@ -35,26 +35,32 @@ const OpenSourcePage: FC = observer( ({ repositories, contributors }) => ( -

{t('open_source_code')}

+

{t('open_source_code')}

- {SourceRepository.map((list, index) => ( + {[...SourceRepository].reverse().map((list, index, { length }) => (
-

v{index + 1}

+

v{length - index}

-
    + {list.map(name => { const repository = repositories.find( ({ full_name }) => full_name === name, ); return ( - + + <>} + /> + ); })} -
+
))} -

{t('team_members')}

+

{t('team_members')}

({ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 717934c..200248a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,8 +48,8 @@ importers: specifier: ^9.0.2 version: 9.0.2 koajax: - specifier: ^2.0.0 - version: 2.0.0(typescript@5.5.4) + specifier: ^1.1.2 + version: 1.1.2(typescript@5.5.4) leaflet: specifier: ^1.9.4 version: 1.9.4 @@ -3027,11 +3027,6 @@ packages: peerDependencies: jsdom: '>=21' - koajax@2.0.0: - resolution: {integrity: sha512-05kjwLO43jb9/dLZfIBjkMvGRQd2j9lRnyR+ijin33tmqzSQIrSzYo9pfn/jdbrlcMHOHoHJGZbQLt8zuGGuqA==} - peerDependencies: - jsdom: '>=21' - language-subtag-registry@0.3.23: resolution: {integrity: sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ==} @@ -4612,10 +4607,6 @@ packages: resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} engines: {node: '>= 8'} - web-streams-polyfill@4.0.0: - resolution: {integrity: sha512-0zJXHRAYEjM2tUfZ2DiSOHAa2aw1tisnnhU3ufD57R8iefL+DcdJyRBRyJpG+NUimDgbTI/lH+gAE1PAvV3Cgw==} - engines: {node: '>= 8'} - web-utility@4.4.0: resolution: {integrity: sha512-Bw0RcX5jBNuw+FQ2NKkkegNK07czjXoUtDNpRO+2ueNNv3FL8GsTTU27eM+17bzFPpYqukAdkCLJf5ZAYiDZtg==} peerDependencies: @@ -8404,16 +8395,6 @@ snapshots: transitivePeerDependencies: - typescript - koajax@2.0.0(typescript@5.5.4): - dependencies: - '@swc/helpers': 0.5.12 - iterable-observer: 1.1.0 - regenerator-runtime: 0.14.1 - web-streams-polyfill: 4.0.0 - web-utility: 4.4.0(typescript@5.5.4) - transitivePeerDependencies: - - typescript - language-subtag-registry@0.3.23: {} language-tags@1.0.9: @@ -10154,8 +10135,6 @@ snapshots: web-streams-polyfill@3.3.3: {} - web-streams-polyfill@4.0.0: {} - web-utility@4.4.0(typescript@5.5.4): dependencies: '@swc/helpers': 0.5.12