♻️ refactored login-related code
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
@@ -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
57
src/api/oauth/index.ts
Normal 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
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
@@ -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
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
@@ -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,
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user