auf hope-fly geaendert
This commit is contained in:
@ -20,16 +20,14 @@ function App()
|
||||
<BrowserRouter basename='/dog'>
|
||||
<Routes>
|
||||
{ user && <Route path="/" element={<Home/>} /> }
|
||||
{user && (
|
||||
{ (
|
||||
<>
|
||||
<Route path="/:qr_id" element={<Dog/>} />
|
||||
<Route path="/login" element={<Login/>} />
|
||||
<Route path="/reg" element={<Register/>} />
|
||||
</>
|
||||
)}
|
||||
{/* <Route path="*" element={<Navigate to={user ? '/':'/login'} />} /> */}
|
||||
<Route path="/login" element={<Login/>} />
|
||||
<Route path="/reg" element={<Register/>} />
|
||||
<Route path="*" element={<Navigate to={user ? '/':'/login'} />} />
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
</div>
|
||||
|
||||
@ -48,7 +48,8 @@ export type UserCtxT =
|
||||
export const UserCtx = createContext<UserCtxT | null>(null);
|
||||
|
||||
export const Axios = axios.create({
|
||||
baseURL: 'http://localhost/dog/php-dog/',
|
||||
// baseURL: 'http://localhost/dog/php-dog/',
|
||||
baseURL: 'https://hope-fly.de/dog/php-dog/',
|
||||
});
|
||||
|
||||
export const UserCtxProvider = ({children}:TUserContextProviderProps) => {
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
$routes =
|
||||
[
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
route('/', function () {
|
||||
echo "Home Page";
|
||||
});
|
||||
|
||||
route('/login', function () {
|
||||
echo "Login Page";
|
||||
});
|
||||
|
||||
route('/about-us', function () {
|
||||
echo "About Us";
|
||||
});
|
||||
|
||||
route('/404', function () {
|
||||
echo "Page not found";
|
||||
});
|
||||
|
||||
function route(string $path, callable $callback) {
|
||||
global $routes;
|
||||
$routes[$path] = $callback;
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
function run() {
|
||||
global $routes;
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
$found = false;
|
||||
foreach ($routes as $path => $callback) {
|
||||
if ($path !== $uri) continue;
|
||||
|
||||
$found = true;
|
||||
$callback();
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$notFoundCallback = $routes['/404'];
|
||||
$notFoundCallback();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user