Skip to content

Commit

Permalink
chore: improve ts notation
Browse files Browse the repository at this point in the history
  • Loading branch information
w2xi committed Oct 7, 2024
1 parent 3cbfae1 commit dfe0b6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/mock/business/article.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Mock from 'mockjs'
import response from '../response'
import type { MockjsRequestOptions } from 'mockjs'
import type { ArticleList } from '@/interface/business/article'

const data: ArticleList = []
Expand All @@ -20,7 +21,7 @@ for (let i = 0; i < count; i++) {
)
}

Mock.mock('/api/business/article/list', 'get', (config: any) => {
Mock.mock('/api/business/article/list', 'get', (config: MockjsRequestOptions) => {
const { page = 1, limit = 20 } = JSON.parse(config.body)
const start = (page - 1) * limit
const end = start + limit
Expand All @@ -30,7 +31,7 @@ Mock.mock('/api/business/article/list', 'get', (config: any) => {
})
})

Mock.mock('/api/business/article/delete', 'delete', (config: any) => {
Mock.mock('/api/business/article/delete', 'delete', (config: MockjsRequestOptions) => {
const { id } = JSON.parse(config.body)
const index = data.findIndex(item => item.id === id)
if (index !== -1) {
Expand All @@ -39,7 +40,7 @@ Mock.mock('/api/business/article/delete', 'delete', (config: any) => {
return response({})
})

Mock.mock('/api/business/article/edit', 'post', (config: any) => {
Mock.mock('/api/business/article/edit', 'post', (config: MockjsRequestOptions) => {
const { id, author, title, importance, status } = JSON.parse(config.body)
const index = data.findIndex(item => item.id === id)
if (index !== -1) {
Expand Down
3 changes: 2 additions & 1 deletion src/mock/user/login.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Mock from 'mockjs'
import response from '../response'
import type { MockjsRequestOptions } from 'mockjs'

Mock.mock('/api/user/login', 'post', (config: any) => {
Mock.mock('/api/user/login', 'post', (config: MockjsRequestOptions) => {
const { username } = JSON.parse(config.body)
return response({
username,
Expand Down

0 comments on commit dfe0b6f

Please sign in to comment.