Skip to content

Commit

Permalink
[optimize] update build client
Browse files Browse the repository at this point in the history
  • Loading branch information
wangrunlin committed Aug 5, 2023
1 parent 5dfcb1f commit 97ceae5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions models/Base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { HTTPClient } from 'koajax';

import { lark } from '../pages/api/Lark/core';

export const isServer = () => typeof window === 'undefined';

export const VercelHost = process.env.VERCEL_URL,
Expand All @@ -14,12 +16,12 @@ const API_Host = isServer()

const { BUILDING } = process.env;

export const larkClient = new HTTPClient({
baseURI: BUILDING
? 'https://open.feishu.cn/open-apis/'
: `${API_Host}/api/Lark/`,
responseType: 'json',
});
export const larkClient = BUILDING
? lark.client
: new HTTPClient({
baseURI: `${API_Host}/api/Lark/`,
responseType: 'json',
});

export const githubClient = new HTTPClient({
baseURI: 'https://api.github.com/',
Expand Down
2 changes: 2 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import { i18n } from '../models/Translation';
import styles from '../styles/Home.module.less';
import { getTarget } from './api/core';
import { service } from './api/home';
import { lark } from './api/Lark/core';

export const getStaticProps = async () => {
await lark.getAccessToken();
const [projects, repositories, partners, members] = await Promise.all([
new ProjectModel().getList({}, 1, 9),
new RepositoryModel().getList(),
Expand Down

1 comment on commit 97ceae5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for idea2app ready!

✅ Preview
https://idea2app-4jt6htp86-techquery.vercel.app

Built with commit 97ceae5.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.