Skip to content

Commit 0ce9f38

Browse files
CopilotTechQuery
andcommitted
Configure @idea2app/data-server package access and update types
Co-authored-by: TechQuery <[email protected]>
1 parent a558d15 commit 0ce9f38

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
public-hoist-pattern[] = *import-in-the-middle*
22
public-hoist-pattern[] = *require-in-the-middle*
33
auto-install-peers = false
4+
5+
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
6+
@idea2app:registry=https://npm.pkg.github.com
7+
always-auth=true

components/Git/Issue/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const IssueCard: FC<IssueCardProps> = ({
4848
)}
4949
</div>
5050

51-
<article dangerouslySetInnerHTML={{ __html: marked(body || '') }} />
51+
<article dangerouslySetInnerHTML={{ __html: marked(body || '', { async: false }) as string }} />
5252

5353
<footer className="flex items-center justify-between">
5454
{user && (

components/Member/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const MemberCard: FC<MemberCardProps> = observer(
5959
</ul>
6060

6161
<p
62-
dangerouslySetInnerHTML={{ __html: marked((summary as string) || '') }}
62+
dangerouslySetInnerHTML={{ __html: marked((summary as string) || '', { async: false }) as string }}
6363
className="text-neutral-500"
6464
/>
6565
</li>

components/User/SessionBox.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Drawer, List, ListItem, ListItemButton, ListItemText } from '@mui/material';
2+
import { JwtPayload } from 'jsonwebtoken';
23
import { observable } from 'mobx';
34
import { observer } from 'mobx-react';
45
import Link from 'next/link';
@@ -12,7 +13,7 @@ export type MenuItem = Pick<JSX.IntrinsicElements['a'], 'href' | 'title'>;
1213
export interface SessionBoxProps extends HTMLAttributes<HTMLDivElement> {
1314
path?: string;
1415
menu?: MenuItem[];
15-
jwtPayload?: any; // TODO: Define proper JWT payload type
16+
jwtPayload?: JwtPayload;
1617
}
1718

1819
@observer

models/Base.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { HTTPClient } from 'koajax';
22
import MIME from 'mime';
33
import { githubClient } from 'mobx-github';
44
import { TableCellValue, TableCellMedia, TableCellAttachment } from 'mobx-lark';
5-
import { Filter, ListModel, toggle, IDType } from 'mobx-restful';
5+
import { Filter, ListModel, toggle, IDType, DataObject } from 'mobx-restful';
6+
import type { PageData } from 'mobx-restful';
67
import { buildURLData } from 'web-utility';
78

89
import { API_Host, GITHUB_TOKEN, isServer } from './configuration';
@@ -37,7 +38,7 @@ export function fileURLOf(field: TableCellValue, cache = false) {
3738
return URI;
3839
}
3940

40-
export abstract class TableModel<D extends Base, F extends Filter<D> = Filter<D>> extends ListModel<
41+
export abstract class TableModel<D extends DataObject, F extends Filter<D> = Filter<D>> extends ListModel<
4142
D,
4243
F
4344
> {
@@ -51,7 +52,7 @@ export abstract class TableModel<D extends Base, F extends Filter<D> = Filter<D>
5152
}
5253

5354
async loadPage(pageIndex: number, pageSize: number, filter: F) {
54-
const { body } = await this.client.get<ListChunk<D>>(
55+
const { body } = await this.client.get<{ list: D[], count: number }>(
5556
`${this.baseURI}?${buildURLData({ ...filter, pageIndex, pageSize })}`,
5657
);
5758

models/User.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ import { HTTPClient } from 'koajax';
33
import { observable, reaction } from 'mobx';
44
import { persist, restore, toggle } from 'mobx-restful';
55
import { setCookie } from 'web-utility';
6+
import { User as GitHubUser } from 'mobx-github';
67

78
import { TableModel } from './Base';
89
import { API_Host, isServer } from './configuration';
910

10-
export interface User {
11-
id?: string;
12-
email?: string;
13-
nickname?: string;
14-
avatar?: string;
11+
export interface User extends GitHubUser {
1512
token?: string;
1613
}
1714

next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const nextConfig = withPWA({
4545
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
4646
return config;
4747
},
48-
rewrites,
48+
rewrites: rewrites as any,
4949
});
5050

5151
export default isDev || !SENTRY_AUTH_TOKEN

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@emotion/server": "^11.11.0",
1313
"@emotion/styled": "^11.14.1",
1414
"@giscus/react": "^3.1.0",
15+
"@idea2app/data-server": "^1.0.0-rc.0",
1516
"@koa/bodyparser": "^6.0.0",
1617
"@koa/router": "^14.0.0",
1718
"@mui/lab": "^7.0.0-beta.16",

0 commit comments

Comments
 (0)