Skip to content

Commit

Permalink
Fixes base url
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis committed Nov 26, 2024
1 parent efab71c commit e21d443
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/components/SideMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';
import { SUPPORTED_LANGUAGES } from '../i18n/config';
import Flags from 'country-flag-icons/react/3x2';
import * as Flags from 'country-flag-icons/react/3x2';
import { Link } from 'react-router-dom';

function Flag({className, code}: {className?: string, code: string}) {
Expand Down
27 changes: 13 additions & 14 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@ function Redirect({ to }: { to: string }) {
return null;
}

const router = createBrowserRouter([
{
path: "/",
element: <Home />,
},
{
path: "/pairing",
element: <Pairing />,
},
{
path: "/pairing.html",
element: <Redirect to="/pairing" />
}
]);
const router = createBrowserRouter([{
path: "/",
element: <Home />,
}, {
path: "/pairing",
element: <Pairing />,
}, {
path: "/pairing.html",
element: <Redirect to="/pairing" />
}], {
// @ts-ignore
basename: import.meta.env.BASE_URL,
});

const root = createRoot(document.getElementById("root")!);
root.render(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function Home() {
};

const getAssignmentLink = async (giver: string, receiver: string) => {
const baseUrl = window.location.origin;
const baseUrl = `${window.location.origin}${window.location.pathname.replace(/\/[^/]*$/, '')}`;
const encryptedReceiver = await encryptText(receiver);
return `${baseUrl}/pairing?from=${encodeURIComponent(giver)}&to=${encodeURIComponent(encryptedReceiver)}`;
};
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "ES2022", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
base: '/secretsanta/',
plugins: [react()],
})

0 comments on commit e21d443

Please sign in to comment.