SubDomain ayarları

This commit is contained in:
Sedat ÖZTÜRK 2025-08-11 17:32:28 +03:00
parent 91be964a39
commit c7c0b061a9
4 changed files with 22 additions and 12 deletions

View file

@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.1jmha53s5bo"
"revision": "0.fduoepfh2f"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

View file

@ -12,6 +12,7 @@ import appConfig from '@/configs/app.config'
import dayjs from 'dayjs'
import { components } from 'react-select'
import { ROUTES_ENUM } from '@/routes/route.constant'
import { hasSubdomain } from '@/utils/subdomain'
interface SimpleProps extends CommonProps {
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">
<Card className="min-w-[320px] md:min-w-[450px]" bodyClass="md:p-10">
<div className="flex justify-between items-center mb-4">
<a
href={ROUTES_ENUM.public.home}
rel="noopener noreferrer"
className="text-gray-500 hover:text-gray-700"
>
<HiArrowLeft className="text-2xl" />
</a>
{!hasSubdomain() && (
<a
href={ROUTES_ENUM.public.home}
rel="noopener noreferrer"
className="text-gray-500 hover:text-gray-700"
>
<HiArrowLeft className="text-2xl" />
</a>
)}
<div className="w-12">
<Select
className='cursor-pointer'
className="cursor-pointer"
options={languageOptions}
components={{
Option: CustomSelectOption,

View file

@ -44,7 +44,9 @@ export const DynamicRouter: React.FC = () => {
</Route>
{dynamicRoutes
.filter((r) => r.routeType !== 'protected')
.filter((r) =>
hasSubdomain() ? r.routeType === 'authenticated' : r.routeType !== 'protected',
)
.map((route) => {
const Component = route.getComponent()
return (
@ -70,8 +72,12 @@ export const DynamicRouter: React.FC = () => {
}
/>
{/* Not Found */}
<Route path="*" element={<NotFound />} />
<Route
path="*"
element={
hasSubdomain() ? <Navigate to={ROUTES_ENUM.authenticated.login} replace /> : <NotFound />
}
/>
</Routes>
)
}

View file

@ -20,5 +20,6 @@ export const getSubdomain = (): string | null => {
}
export const hasSubdomain = (): boolean => {
return true
return getSubdomain() !== null
}