Browse Source

chore: cleanup

main
刘凯 1 year ago
parent
commit
0df428f594
  1. 5
      src/api/base/login.ts
  2. 11
      src/views/base/login/LoginForm.vue

5
src/api/base/login.ts

@ -23,11 +23,6 @@ export function getTenantIdByName(name: string) {
return defHttp.get<TentantNameVO>({ url: Api.GetTenantIdByName + name })
}
// 使用租户域名,获得租户信息
export function getTenantByWebsite(website: string) {
return defHttp.get({ url: `/system/tenant/get-by-website?website=${website}` }, { errorMessageMode: 'none' })
}
// 登出
export function loginOut() {
return defHttp.delete({ url: Api.LoginOut })

11
src/views/base/login/LoginForm.vue

@ -18,8 +18,7 @@ import { useDesign } from '@/hooks/web/useDesign'
import * as authUtil from '@/utils/auth'
import { Verify } from '@/components/Verifition'
import { getTenantByWebsite, getTenantIdByName } from '@/api/base/login'
import { noop } from '@/utils'
import { getTenantIdByName } from '@/api/base/login'
const FormItem = Form.Item
const InputPassword = Input.Password
@ -71,18 +70,10 @@ async function getCode() {
// && ID
async function getTenantId() {
if (tenantEnable === 'true') {
const website = location.host
const tenant = await getTenantByWebsite(website).catch(noop)
if (tenant) {
formData.tenantName = tenant.name
authUtil.setTenantId(tenant.id)
}
else {
const res = await getTenantIdByName(formData.tenantName)
authUtil.setTenantId(res)
}
}
}
async function handleLogin(params) {
await getTenantId()