chore: user apikeys

This commit is contained in:
jialin
2024-06-23 15:15:12 +08:00
parent a03a95a3bc
commit ff1cf01edf
24 changed files with 481 additions and 180 deletions
+29
View File
@@ -0,0 +1,29 @@
import { request } from '@umijs/max';
import qs from 'query-string';
export const AUTH_API = '/auth';
export const login = async (
params: { username: string; password: string },
options?: any
) => {
return request(`${AUTH_API}/login`, {
method: 'POST',
data: qs.stringify(params),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
};
export const logout = async (userInfo: any) => {
return request(`${AUTH_API}/logout`, {
method: 'POST'
});
};
export const accessToken = async () => {
return request(`${AUTH_API}/token`, {
method: 'POST'
});
};