github oauth2 login / gitee oauth2 login

This commit is contained in:
landaiqing
2024-08-19 00:14:37 +08:00
parent 0c3edc360c
commit 8998259791
8 changed files with 231 additions and 31 deletions

View File

@@ -1,62 +0,0 @@
import {service} from "@/utils/alova/service.ts";
/**
* 生成客户端id
*/
export const generateClientId = () => {
return service.Get('/api/oauth/generate_client_id',
{
meta: {
ignoreToken: true,
},
cacheFor: {
mode: "restore",
expire: 1000 * 60 * 60 * 24 * 30 // 30天
}
}
);
};
/**
* 获取临时二维码
* @param clientId
*/
export const generateQrCode = (clientId: string) => {
return service.Get('/api/oauth/get_temp_qrcode',
{
params: {
client_id: clientId
},
meta: {
ignoreToken: true,
},
}
);
};
/**
* 关闭websocket
* @param clientId
*/
export const closeWebsocket = (clientId: string) => {
return service.Get('/api/ws/delete',
{
params: {
client_id: clientId
},
meta: {
ignoreToken: true,
},
}
);
};
export const sendSocketMessage = (clientId: string) => {
return service.Get('/api/ws/send',
{
params: {
client_id: clientId
},
meta: {
ignoreToken: true,
},
}
);
};