chore: 适配部分 API 响应格式调整为 kv 格式的变化

This commit is contained in:
2024-03-06 22:53:06 +08:00
parent b4bb4693df
commit 6f5c35ea77
4 changed files with 9 additions and 5 deletions

View File

@@ -49,8 +49,12 @@ export function listRoute() {
return axios.get<RouteRecordNormalized[]>(`${BASE_URL}/route`); return axios.get<RouteRecordNormalized[]>(`${BASE_URL}/route`);
} }
export interface SocialAuthAuthorizeResp {
authorizeUrl: string;
}
export function socialAuth(source: string) { export function socialAuth(source: string) {
return axios.get<string>(`/oauth/${source}`); return axios.get<SocialAuthAuthorizeResp>(`/oauth/${source}`);
} }
export function socialLogin(source: string, req: any) { export function socialLogin(source: string, req: any) {

View File

@@ -17,7 +17,7 @@
*/ */
const handleSocialAuth = async (source: string) => { const handleSocialAuth = async (source: string) => {
const { data } = await socialAuth(source); const { data } = await socialAuth(source);
window.location.href = data; window.location.href = data.authorizeUrl;
}; };
const toggleLoginMode = () => { const toggleLoginMode = () => {

View File

@@ -121,7 +121,7 @@
upload(formData) upload(formData)
.then((res) => { .then((res) => {
onSuccess(res); onSuccess(res);
form.value.site_logo = res.data; form.value.site_logo = res.data.url;
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}) })
.catch((error) => { .catch((error) => {
@@ -156,7 +156,7 @@
upload(formData) upload(formData)
.then((res) => { .then((res) => {
onSuccess(res); onSuccess(res);
form.value.site_favicon = res.data; form.value.site_favicon = res.data.url;
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}) })
.catch((error) => { .catch((error) => {

View File

@@ -57,7 +57,7 @@
hideCancel: false, hideCancel: false,
onOk: () => { onOk: () => {
socialAuth(source).then((res) => { socialAuth(source).then((res) => {
window.location.href = res.data; window.location.href = res.data.authorizeUrl;
}); });
}, },
}); });