Skip to content

Commit

Permalink
feat(tenant): host 修改逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaojingjing committed Jan 16, 2024
1 parent 7fd6252 commit 7d692a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { CreateTenantProps } from '../interface'
import '../styles.less'
import { TenantBusinessAction, authFlow } from '../businessRequest'
import {
useGuardAppId,
useGuardCurrentModule,
useGuardEvents,
useGuardHttpClient,
Expand All @@ -24,6 +25,7 @@ export const CreateTenantView: React.FC<CreateTenantProps> = ({ onBack }) => {
const publicConfig = useGuardPublicConfig()
const cdnBase = publicConfig?.cdnBase
const { moduleName } = useGuardCurrentModule()
const appId = useGuardAppId()

const [form] = Form.useForm()
const submitButtonRef = useRef<any>(null)
Expand All @@ -42,7 +44,7 @@ export const CreateTenantView: React.FC<CreateTenantProps> = ({ onBack }) => {
// 需要重新认证
const tenantInfo = { ...data }
events?.onTenantSelect?.(tenantInfo)
if (tenantInfo?.host) {
if (tenantInfo?.host && appId !== publicConfig.defaultAppId) {
http.setBaseUrl(tenantInfo?.host)
} else {
http.setBaseUrl(window.location.origin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { JoinTenantStepEnum, JoinTenantProps } from '../interface'
import {
getGuardHttp,
mailDesensitization,
useGuardAppId,
useGuardEvents,
useGuardHttp,
useGuardHttpClient,
Expand All @@ -30,6 +31,7 @@ export const JoinTenantView: React.FC<JoinTenantProps> = ({ onBack }) => {
const config = useGuardPublicConfig()
const authClient = useGuardAuthClient()
const http = useGuardHttpClient()
const appId = useGuardAppId()

const [tenantInfo, setTenantInfo] = useState<any>(null)
const [currStepKey, setCurrStepKey] = useState<JoinTenantStepEnum>(
Expand All @@ -42,7 +44,7 @@ export const JoinTenantView: React.FC<JoinTenantProps> = ({ onBack }) => {

const handelJoinTenant = async (tenantInfo: any, passCode?: string) => {
try {
if (tenantInfo?.host) {
if (tenantInfo?.host && appId !== config.defaultAppId) {
http.setBaseUrl(tenantInfo?.host)
} else {
http.setBaseUrl(window.location.origin)
Expand Down
2 changes: 2 additions & 0 deletions packages/guard-core-v4/src/Type/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,6 @@ export interface ApplicationConfig {
enableVerifyDomainInJoinTenant: boolean

passkeyEnabled: boolean

defaultAppId: string // 默认应用
}

0 comments on commit 7d692a9

Please sign in to comment.