diff --git a/custom/fitness-demo/components/Prejoin/Intro.js b/custom/fitness-demo/components/Prejoin/Intro.js
index 889ab71..987cddd 100644
--- a/custom/fitness-demo/components/Prejoin/Intro.js
+++ b/custom/fitness-demo/components/Prejoin/Intro.js
@@ -20,7 +20,6 @@ import PropTypes from 'prop-types';
export const Intro = ({
tokenError,
fetching,
- room,
error,
onJoin,
}) => {
@@ -46,10 +45,6 @@ export const Intro = ({
return () => clearInterval(i);
}, []);
- useEffect(() => {
- setRoomName(room);
- }, [room]);
-
return (
diff --git a/custom/fitness-demo/pages/[slug].js b/custom/fitness-demo/pages/[slug].js
new file mode 100644
index 0000000..54cce71
--- /dev/null
+++ b/custom/fitness-demo/pages/[slug].js
@@ -0,0 +1,66 @@
+import React from 'react';
+import { CallProvider } from '@custom/shared/contexts/CallProvider';
+import { MediaDeviceProvider } from '@custom/shared/contexts/MediaDeviceProvider';
+import { ParticipantsProvider } from '@custom/shared/contexts/ParticipantsProvider';
+import { TracksProvider } from '@custom/shared/contexts/TracksProvider';
+import { UIStateProvider } from '@custom/shared/contexts/UIStateProvider';
+import { WaitingRoomProvider } from '@custom/shared/contexts/WaitingRoomProvider';
+import getDemoProps from '@custom/shared/lib/demoProps';
+import { useRouter } from 'next/router';
+import App from '../components/App';
+import NotConfigured from '../components/Prejoin/NotConfigured';
+
+const Slug = ({
+ domain,
+ isConfigured = false,
+ subscribeToTracksAutomatically = true,
+ asides,
+ modals,
+ customTrayComponent,
+ customAppComponent,
+}) => {
+ const router = useRouter();
+ const { slug, t } = router.query;
+
+ if (!isConfigured) return ;
+ return (
+
+
+
+
+
+
+ {customAppComponent || }
+
+
+
+
+
+
+ )
+};
+
+export default Slug;
+
+export async function getStaticProps() {
+ const defaultProps = getDemoProps();
+ return {
+ props: defaultProps,
+ };
+}
+
+export async function getStaticPaths() {
+ return {
+ paths: [],
+ fallback: 'blocking',
+ }
+}
\ No newline at end of file
diff --git a/custom/fitness-demo/pages/index.js b/custom/fitness-demo/pages/index.js
index f9e1a8f..7ad426c 100644
--- a/custom/fitness-demo/pages/index.js
+++ b/custom/fitness-demo/pages/index.js
@@ -1,13 +1,7 @@
import React, { useState, useCallback } from 'react';
-import { CallProvider } from '@custom/shared/contexts/CallProvider';
-import { MediaDeviceProvider } from '@custom/shared/contexts/MediaDeviceProvider';
-import { ParticipantsProvider } from '@custom/shared/contexts/ParticipantsProvider';
-import { TracksProvider } from '@custom/shared/contexts/TracksProvider';
-import { UIStateProvider } from '@custom/shared/contexts/UIStateProvider';
-import { WaitingRoomProvider } from '@custom/shared/contexts/WaitingRoomProvider';
import getDemoProps from '@custom/shared/lib/demoProps';
+import { useRouter } from 'next/router';
import PropTypes from 'prop-types';
-import App from '../components/App';
import Intro from '../components/Prejoin/Intro';
import NotConfigured from '../components/Prejoin/NotConfigured';
@@ -22,18 +16,12 @@ import NotConfigured from '../components/Prejoin/NotConfigured';
export default function Index({
domain,
isConfigured = false,
- subscribeToTracksAutomatically = true,
- asides,
- modals,
- customTrayComponent,
- customAppComponent,
}) {
- const [roomName, setRoomName] = useState();
+ const router = useRouter();
const [fetching, setFetching] = useState(false);
const [error, setError] = useState();
const [fetchingToken, setFetchingToken] = useState(false);
- const [token, setToken] = useState();
const [tokenError, setTokenError] = useState();
const getMeetingToken = useCallback(async (room, isOwner = false) => {
@@ -60,13 +48,10 @@ export default function Index({
console.log(`🪙 Token received`);
setFetchingToken(false);
- setToken(resJson.token);
-
- // Setting room name will change ready state
- setRoomName(room);
+ await router.push(`/${room}?t=${resJson.token}`);
return true;
- }, []);
+ }, [router]);
const createRoom = async (room, duration, privacy) => {
setError(false);
@@ -99,63 +84,33 @@ export default function Index({
setFetching(false);
}
- const isReady = !!(isConfigured && roomName);
-
- if (!isReady) {
- return (
-
- {(() => {
- if (!isConfigured) return ;
- return (
-
- type === 'join' ? setRoomName(room): createRoom(room, duration, privacy)
- }
- />
- );
- })()}
-
-
-
- );
- }
-
/**
* Main call UI
*/
return (
-
-
-
-
-
-
- {customAppComponent || }
-
-
-
-
-
-
+
+ {(() => {
+ if (!isConfigured) return ;
+ return (
+
+ type === 'join' ? router.push(`/${room}`): createRoom(room, duration, privacy)
+ }
+ />
+ );
+ })()}
+
+
+
);
}