refactor axios.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { useAxios } from "@vueuse/integrations/useAxios"
|
||||
import http from "../utils/http"
|
||||
|
||||
export function login(data: { username: string; password: string }) {
|
||||
return http.post("login", data)
|
||||
return useAxios("login", { method: "post", data }, http, {
|
||||
immediate: false,
|
||||
})
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
@@ -9,7 +12,7 @@ export function logout() {
|
||||
}
|
||||
|
||||
export function getUserInfo(username: string) {
|
||||
return http.get("profile", {
|
||||
params: { username },
|
||||
return useAxios("profile", { method: "get", params: { username } }, http, {
|
||||
immediate: false,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user