chore: 适配部分 API 响应格式调整为 kv 格式的变化
This commit is contained in:
@@ -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) {
|
||||||
|
@@ -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 = () => {
|
||||||
|
@@ -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) => {
|
||||||
|
@@ -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;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user