SubDomain ayarları
This commit is contained in:
parent
91be964a39
commit
c7c0b061a9
4 changed files with 22 additions and 12 deletions
|
|
@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
|
||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "index.html",
|
"url": "index.html",
|
||||||
"revision": "0.1jmha53s5bo"
|
"revision": "0.fduoepfh2f"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import appConfig from '@/configs/app.config'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { components } from 'react-select'
|
import { components } from 'react-select'
|
||||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||||
|
import { hasSubdomain } from '@/utils/subdomain'
|
||||||
|
|
||||||
interface SimpleProps extends CommonProps {
|
interface SimpleProps extends CommonProps {
|
||||||
content?: ReactNode
|
content?: ReactNode
|
||||||
|
|
@ -92,17 +93,19 @@ const Simple = ({ children, content, ...rest }: SimpleProps) => {
|
||||||
<Container className="flex flex-col flex-auto items-center justify-center min-w-0 h-full">
|
<Container className="flex flex-col flex-auto items-center justify-center min-w-0 h-full">
|
||||||
<Card className="min-w-[320px] md:min-w-[450px]" bodyClass="md:p-10">
|
<Card className="min-w-[320px] md:min-w-[450px]" bodyClass="md:p-10">
|
||||||
<div className="flex justify-between items-center mb-4">
|
<div className="flex justify-between items-center mb-4">
|
||||||
<a
|
{!hasSubdomain() && (
|
||||||
href={ROUTES_ENUM.public.home}
|
<a
|
||||||
rel="noopener noreferrer"
|
href={ROUTES_ENUM.public.home}
|
||||||
className="text-gray-500 hover:text-gray-700"
|
rel="noopener noreferrer"
|
||||||
>
|
className="text-gray-500 hover:text-gray-700"
|
||||||
<HiArrowLeft className="text-2xl" />
|
>
|
||||||
</a>
|
<HiArrowLeft className="text-2xl" />
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="w-12">
|
<div className="w-12">
|
||||||
<Select
|
<Select
|
||||||
className='cursor-pointer'
|
className="cursor-pointer"
|
||||||
options={languageOptions}
|
options={languageOptions}
|
||||||
components={{
|
components={{
|
||||||
Option: CustomSelectOption,
|
Option: CustomSelectOption,
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ export const DynamicRouter: React.FC = () => {
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
{dynamicRoutes
|
{dynamicRoutes
|
||||||
.filter((r) => r.routeType !== 'protected')
|
.filter((r) =>
|
||||||
|
hasSubdomain() ? r.routeType === 'authenticated' : r.routeType !== 'protected',
|
||||||
|
)
|
||||||
.map((route) => {
|
.map((route) => {
|
||||||
const Component = route.getComponent()
|
const Component = route.getComponent()
|
||||||
return (
|
return (
|
||||||
|
|
@ -70,8 +72,12 @@ export const DynamicRouter: React.FC = () => {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Not Found */}
|
<Route
|
||||||
<Route path="*" element={<NotFound />} />
|
path="*"
|
||||||
|
element={
|
||||||
|
hasSubdomain() ? <Navigate to={ROUTES_ENUM.authenticated.login} replace /> : <NotFound />
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,6 @@ export const getSubdomain = (): string | null => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const hasSubdomain = (): boolean => {
|
export const hasSubdomain = (): boolean => {
|
||||||
|
return true
|
||||||
return getSubdomain() !== null
|
return getSubdomain() !== null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue