diff --git a/tools/challenge-editor/client/interfaces/prop-types.ts b/tools/challenge-editor/client/interfaces/prop-types.ts index f0a32a441af..2bb76daf4be 100644 --- a/tools/challenge-editor/client/interfaces/prop-types.ts +++ b/tools/challenge-editor/client/interfaces/prop-types.ts @@ -1,17 +1,9 @@ -export interface ChallengeContentRequiredProps { - superblock: string; - block: string; - challenge: string; +export interface BlockRequiredProps { + superblock?: string; + block?: string; +} + +export interface ChallengeContentRequiredProps extends BlockRequiredProps { + challenge?: string; content: string; } - -export interface ChallengeRequiredProps { - superblock: string; - block: string; - challenge: string; -} - -export interface BlockRequiredProps { - superblock: string; - block: string; -} diff --git a/tools/challenge-editor/client/src/components/editor/editor.tsx b/tools/challenge-editor/client/src/components/editor/editor.tsx index d61ec254f26..57a6a5f8485 100644 --- a/tools/challenge-editor/client/src/components/editor/editor.tsx +++ b/tools/challenge-editor/client/src/components/editor/editor.tsx @@ -22,11 +22,7 @@ const Editor = () => { fileData: '' }); const [input, setInput] = useState(''); - const params = useParams() as { - superblock: string; - block: string; - challenge: string; - }; + const { superblock, block, challenge } = useParams(); useEffect(() => { fetchData(); @@ -35,9 +31,7 @@ const Editor = () => { const fetchData = () => { setLoading(true); - fetch( - `${API_LOCATION}/${params.superblock}/${params.block}/${params.challenge}` - ) + fetch(`${API_LOCATION}/${superblock}/${block}/${challenge}`) .then(res => res.json() as Promise) .then( content => { @@ -70,7 +64,7 @@ const Editor = () => {

{items.name}

- {params.superblock} / {params.block} + {superblock} / {block} { }} />

- - Return to Block - + Return to Block

);