refactor
This commit is contained in:
parent
a879af3405
commit
2907ad4bb4
@ -1,6 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import { emit } from './event'
|
||||
import { queryStringify } from './utils'
|
||||
import { showModal } from './notify'
|
||||
import { trans, t } from './i18n'
|
||||
|
||||
@ -106,10 +105,10 @@ export function get<T = any>(url: string, params = empty): Promise<T> {
|
||||
data: params,
|
||||
})
|
||||
|
||||
const qs = queryStringify(params)
|
||||
const qs = new URLSearchParams(params)
|
||||
|
||||
return walkFetch(
|
||||
new Request(`${blessing.base_url}${url}${qs && `?${qs}`}`, init),
|
||||
new Request(`${blessing.base_url}${url}?${qs}`, init),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ test('the GET method', async () => {
|
||||
expect(json).toBeCalled()
|
||||
|
||||
await net.get('/abc')
|
||||
expect(window.fetch.mock.calls[1][0].url).toBe('/abc')
|
||||
expect(window.fetch.mock.calls[1][0].url).toBe('/abc?')
|
||||
})
|
||||
|
||||
test('the POST method', async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user