chore: remove deprecated routes
This commit is contained in:
@@ -87,14 +87,6 @@ describe('test note client', () => {
|
||||
expect(data.title).toBe('1')
|
||||
})
|
||||
|
||||
it('should like note', async () => {
|
||||
mockResponse('/notes/like/1', null)
|
||||
|
||||
const data = await client.note.likeIt('1')
|
||||
|
||||
expect(data).toBeNull()
|
||||
})
|
||||
|
||||
it('should forbidden if no password provide', async () => {
|
||||
spyOn(axiosAdaptor, 'get').mockRejectedValue({
|
||||
response: {
|
||||
|
||||
@@ -66,12 +66,4 @@ describe('test post client', () => {
|
||||
expect(data).toStrictEqual({ title: '1' })
|
||||
expect(data.$raw).toBeDefined()
|
||||
})
|
||||
|
||||
it('should thumbs-up post', async () => {
|
||||
mockResponse('/posts/_thumbs-up?id=1', null)
|
||||
|
||||
const data = await client.post.thumbsUp('1')
|
||||
|
||||
expect(data).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -34,13 +34,15 @@ export const createKyAdaptor = (ky: KyInstance) => {
|
||||
get(url, options) {
|
||||
return getDataFromKyResponse(ky.get(url, options))
|
||||
},
|
||||
post(url, options) {
|
||||
async post(url, options) {
|
||||
const data = options.data
|
||||
delete options.data
|
||||
const kyOptions: Options = {
|
||||
...options,
|
||||
|
||||
json: data,
|
||||
}
|
||||
// FIXME https://github.com/sindresorhus/ky/issues/535
|
||||
|
||||
return getDataFromKyResponse(ky.post(url, kyOptions))
|
||||
},
|
||||
|
||||
@@ -8,11 +8,12 @@ import type {
|
||||
NoteWrappedPayload,
|
||||
NoteWrappedWithLikedPayload,
|
||||
} from '~/models/note'
|
||||
import type { HTTPClient } from '../core/client'
|
||||
import type { SortOptions } from './base'
|
||||
|
||||
import { autoBind } from '~/utils/auto-bind'
|
||||
|
||||
import { HTTPClient } from '../core/client'
|
||||
|
||||
declare module '../core/client' {
|
||||
interface HTTPClient<
|
||||
T extends IRequestAdapter = IRequestAdapter,
|
||||
@@ -110,13 +111,6 @@ export class NoteController<ResponseWrapper> implements IController {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 喜欢这篇日记
|
||||
*/
|
||||
likeIt(id: string | number) {
|
||||
return this.proxy.like(id).get<never>()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取专栏内的所有日记
|
||||
*/
|
||||
|
||||
@@ -4,10 +4,11 @@ import type { IRequestHandler, RequestProxyResult } from '~/interfaces/request'
|
||||
import type { SelectFields } from '~/interfaces/types'
|
||||
import type { ModelWithLiked, PaginateResult } from '~/models/base'
|
||||
import type { PostModel } from '~/models/post'
|
||||
import type { HTTPClient } from '../core/client'
|
||||
|
||||
import { autoBind } from '~/utils/auto-bind'
|
||||
|
||||
import { HTTPClient } from '../core/client'
|
||||
|
||||
declare module '../core/client' {
|
||||
interface HTTPClient<
|
||||
T extends IRequestAdapter = IRequestAdapter,
|
||||
@@ -85,11 +86,4 @@ export class PostController<ResponseWrapper> implements IController {
|
||||
getLatest() {
|
||||
return this.proxy.latest.get<ModelWithLiked<PostModel>>()
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
thumbsUp(id: string) {
|
||||
return this.proxy('_thumbs-up').get<void>({ params: { id } })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"cors": "2.8.5",
|
||||
"express": "4.18.2",
|
||||
"form-data": "4.0.0",
|
||||
"ky": "0.33.3",
|
||||
"ky": "1.1.0",
|
||||
"lodash": "4.17.21",
|
||||
"tsup": "7.2.0",
|
||||
"umi-request": "1.4.0",
|
||||
|
||||
Reference in New Issue
Block a user