diff --git a/src/utils/utils.routing.js b/src/utils/utils.routing.js index d18ec1a..c586cea 100644 --- a/src/utils/utils.routing.js +++ b/src/utils/utils.routing.js @@ -22,3 +22,6 @@ export const useHashLocation = () => { export const buildPlayLinkHref = (url, theme = 'default') => `/#/play/${theme}/${encodeURIComponent(url)}` + +export const getFileExtension = fileName => + fileName.split('.').pop() diff --git a/src/views/Player.jsx b/src/views/Player.jsx index 6113aaf..b5ec640 100644 --- a/src/views/Player.jsx +++ b/src/views/Player.jsx @@ -1,11 +1,21 @@ import { h } from 'preact' +import { getFileExtension } from '~/src/utils/utils.routing' + export default function ({params: {theme, encodedUrl}}) { const url = decodeURIComponent(encodedUrl) + const type = getFileExtension(url) + + const fetchGameFile = fetch(url) + .then(response => (console.log(response), response)) + .then(response => response.blob()) + .then(console.log) + .catch(console.log) return (