Skip to content

Commit

Permalink
feat: export all type
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Apr 10, 2024
1 parent 9c6c4ba commit 4f25cdc
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
3 changes: 2 additions & 1 deletion eslint.config.js → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import antfu from '@antfu/eslint-config'

export default antfu({
typescript: true,
ignores: [
'example',
'example/**',
]
})
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@vitejs/plugin-react": "^4.2.1",
"ajax-hook": "^3.0.1",
"less": "^4.2.0",
"typescript": "^5.2.2",
"vite": "^5.2.8",
Expand Down
2 changes: 2 additions & 0 deletions example/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import React from 'react'
import ReactDOM from 'react-dom/client'
import { initializeInstance } from '@pansy/request'
import App from './App.tsx'
import './server'

initializeInstance({
baseURL: '/api',
timeout: 60 * 1000
})

Expand Down
24 changes: 24 additions & 0 deletions example/src/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { proxy } from 'ajax-hook';

proxy({
onRequest: (config, handler) => {
console.log(config)
if (config.url === '/api/users') {
handler.resolve({
config,
status: 200,
headers: {
'content-type': 'application/json'
},
response: {
code: 0,
data: [],
message: 'success'
}
})
return;
}

handler.next(config)
}
})
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"@commitlint/config-conventional": "^19.1.0",
"@release-it/conventional-changelog": "^7.0.0",
"@testing-library/jest-dom": "^6.4.2",
"ajax-hook": "^3.0.1",
"eslint": "^9.0.0",
"eslint": "^8.57.0",
"husky": "^9.0.11",
"jsdom": "^24.0.0",
"lint-staged": "^15.2.2",
Expand Down Expand Up @@ -85,7 +84,7 @@
"access": "public"
},
"lint-staged": {
"*.{ts,tsx}": [
"*.ts": [
"eslint --cache --fix"
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { ErrorShowType } from './types'
export * from './types'
export { createInstance, initializeInstance, request } from './request'

0 comments on commit 4f25cdc

Please sign in to comment.