Skip to content

Commit

Permalink
refactor: ♻️ http request & hook deps
Browse files Browse the repository at this point in the history
  • Loading branch information
AruSeito committed Apr 23, 2023
1 parent cd5a2c4 commit ddf5ecb
Show file tree
Hide file tree
Showing 243 changed files with 2,956 additions and 3,407 deletions.
16 changes: 8 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ module.exports = {
react: {
version: "detect",
},
"import/resolver": {
typescript: {
project: "apps/*/tsconfig.json",
},
},
},
extends: [
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier",
],
plugins: ["@typescript-eslint/eslint-plugin", "import"],
plugins: ["@typescript-eslint/eslint-plugin", "unused-imports"],
parserOptions: {
ecmaFeatures: {
jsx: true,
Expand All @@ -34,5 +27,12 @@ module.exports = {
"react/react-in-jsx-scope": "off",
"import/default": "off",
"react/no-unknown-property": ["error", { ignore: ["css"] }],
"react-hooks/exhaustive-deps": ['error'],
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
]
},
}
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit "${1}"
pnpm commitlint --edit "${1}"
12 changes: 12 additions & 0 deletions apps/builder/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
root: true,
settings: {
"import/resolver": {
typescript: {
project: "./tsconfig.json",
}
},
},
extends: ["../../.eslintrc.js"],
plugins: ["import"],
}
1 change: 0 additions & 1 deletion apps/builder/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
ModalGroup,
NotificationGroup,
} from "@illa-design/react"
import "@/api/base"
import { illaCodeMirrorTooltipStyle } from "@/components/CodeEditor/CodeMirror/theme"
import { GlobalDataProvider } from "@/page/App/context/globalDataProvider"
import { getIsILLAProductMode } from "@/redux/config/configSelector"
Expand Down
15 changes: 9 additions & 6 deletions apps/builder/src/api/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { isEqual } from "lodash"
import { createApp } from "@/api/apps"
import { BuilderApi } from "@/api/base"
import { GUIDE_CONFIG } from "@/config/guide"
import { getTemplateConfig } from "@/config/template"
import { TemplateName } from "@/config/template/interface"
import { actionActions } from "@/redux/currentApp/action/actionSlice"
Expand All @@ -16,17 +13,22 @@ import {
ResourceContent,
ResourceInitialConfig,
} from "@/redux/resource/resourceState"
import { createApp } from "@/services/apps"
import store from "@/store"
import { builderRequest } from "../http"

export const createResource = async (
data: ResourceInitialConfig<ResourceContent>,
) => {
const response = await BuilderApi.asyncTeamRequest<Resource<ResourceContent>>(
const response = await builderRequest<Resource<ResourceContent>>(
{
method: "POST",
url: "/resources",
data,
},
{
needTeamID: true,
},
)
store.dispatch(resourceActions.updateResourceItemReducer(response.data))
return response.data.resourceId
Expand All @@ -36,12 +38,13 @@ export const createAction = async (
appId: string,
data: Partial<ActionItem<ActionContent>>,
) => {
const response = await BuilderApi.asyncTeamRequest<ActionItem<ActionContent>>(
const response = await builderRequest<ActionItem<ActionContent>>(
{
url: `/apps/${appId}/actions`,
method: "POST",
data,
},
{ needTeamID: true },
)
store.dispatch(actionActions.addActionItemReducer(response.data))
return response.data.actionId
Expand Down Expand Up @@ -69,7 +72,7 @@ export const forkTemplateApp = async (
)
const appId = await createApp(appName, appConfig)
if (resourceList.length) {
const actionList = await Promise.all(
await Promise.all(
actions.map((data) => {
const { resourceIndex, ...actionData } = data
const resourceId = resourceList[resourceIndex] || ""
Expand Down
105 changes: 0 additions & 105 deletions apps/builder/src/api/apps/index.ts

This file was deleted.

Loading

0 comments on commit ddf5ecb

Please sign in to comment.