车间能级提升-智能设备管理系统
zhuguifei
2025-04-18 eac7c5321dca68e34db95995db2cabd29b9324da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { http } from '@/utils/http'
import type { LoginParams } from './login.d'
const clientId = import.meta.env.VITE_APP_CLIENT_ID
 
const DEFAULT_TENANT_ID = '000000'
const GRANT_TYPE = 'password'
 
/** GET 请求 */
export const getFooAPI = (name: string) => {
  return http.get<LoginParams>('/foo', { name })
}
 
/** POST 请求 */
export const login = (params: LoginParams) => {
  const { username, password } = params
  // 构造新的请求参数,避免直接修改原始对象
  const requestData = {
    username,
    password,
    clientId,
    tenantId: DEFAULT_TENANT_ID,
    grantType: GRANT_TYPE,
  }
  return http.post<any>('/auth/login', requestData)
}