feat: custom domain setting check
This commit is contained in:
parent
a23536bdda
commit
bda2fc36c8
|
|
@ -1,4 +1,5 @@
|
|||
import { OUR_DOMAIN } from "./env"
|
||||
import { getSite } from "~/models/site.model"
|
||||
|
||||
export const getTenant = async (request: Request, search: URLSearchParams) => {
|
||||
const host = request.headers.get("host")
|
||||
|
|
@ -30,7 +31,13 @@ export const getTenant = async (request: Request, search: URLSearchParams) => {
|
|||
},
|
||||
)
|
||||
const txt = await res.json()
|
||||
return txt?.Answer?.[0]?.data.replace(/^"|"$/g, "")
|
||||
const tenant = txt?.Answer?.[0]?.data.replace(/^"|"$/g, "")
|
||||
if (tenant) {
|
||||
const site = await getSite(tenant)
|
||||
if (site.custom_domain === host) {
|
||||
return tenant
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue