♻️ refactored login-related code

This commit is contained in:
2024-12-21 01:15:57 +08:00
parent 76336d1553
commit 59a8b63ee7
14 changed files with 139 additions and 128 deletions

View File

@@ -1,18 +0,0 @@
import {service} from "@/utils/alova/service.ts";
/**
* 获取Gitee登录链接
*/
export const getGiteeUrl = () => {
return service.Get('/api/oauth/gitee/url',
{
meta: {
ignoreToken: true,
},
cacheFor: {
mode: "restore",
expire: 1000 * 60 * 60 * 24
}
}
);
};

View File

@@ -1,21 +0,0 @@
import {service} from "@/utils/alova/service.ts";
/**
* Get Github OAuth URL
*/
export const getGithubUrl = (state: string) => {
return service.Get('/api/oauth/github/url',
{
params: {
state: state
},
meta: {
ignoreToken: true,
},
cacheFor: {
mode: "restore",
expire: 1000 * 60 * 60 * 24
}
}
);
};

57
src/api/oauth/index.ts Normal file
View File

@@ -0,0 +1,57 @@
import {service} from "@/utils/alova/service.ts";
/**
* 获取Gitee登录链接
*/
export const getGiteeUrl = () => {
return service.Get('/api/oauth/gitee/url',
{
meta: {
ignoreToken: true,
},
cacheFor: {
mode: "restore",
expire: 1000 * 60 * 60 * 24
}
}
);
};
/**
* Get Github OAuth URL
*/
export const getGithubUrl = (state: string) => {
return service.Get('/api/oauth/github/url',
{
params: {
state: state
},
meta: {
ignoreToken: true,
},
cacheFor: {
mode: "restore",
expire: 1000 * 60 * 60 * 24
}
}
);
};
export const getQQUrl = (state: string) => {
return service.Get('/api/oauth/qq/url',
{
params: {
state: state
},
meta: {
ignoreToken: true,
},
cacheFor: {
mode: "restore",
expire: 1000 * 60 * 60 * 24
}
}
);
};

View File

@@ -1,18 +0,0 @@
import {service} from "@/utils/alova/service.ts";
export const getQQUrl = (state: string) => {
return service.Get('/api/oauth/qq/url',
{
params: {
state: state
},
meta: {
ignoreToken: true,
},
cacheFor: {
mode: "restore",
expire: 1000 * 60 * 60 * 24
}
}
);
};

View File

@@ -1,20 +0,0 @@
import {service} from "@/utils/alova/service.ts";
/**
* 获取临时二维码
* @param clientId
*/
export const generateQrCode = (clientId: string) => {
return service.Get('/api/oauth/wechat/qrcode',
{
params: {
client_id: clientId
},
cacheFor: null,
meta: {
ignoreToken: true,
},
}
);
};