FIX: Small fix in app routing
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
d6a462dbe3
commit
38e21b9639
@@ -33,7 +33,7 @@ function App() {
|
|||||||
const queryString = window.location.search;
|
const queryString = window.location.search;
|
||||||
const urlParams = new URLSearchParams(queryString);
|
const urlParams = new URLSearchParams(queryString);
|
||||||
const modelHash = urlParams.get("model");
|
const modelHash = urlParams.get("model");
|
||||||
const filename = urlParams.get("filename");
|
const exampleFilename = urlParams.get("example");
|
||||||
// If there is a model name ?model=modelHash we try to load it
|
// If there is a model name ?model=modelHash we try to load it
|
||||||
// if there is not, or the loading failed we load an empty model
|
// if there is not, or the loading failed we load an empty model
|
||||||
if (modelHash) {
|
if (modelHash) {
|
||||||
@@ -46,15 +46,14 @@ function App() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert("Model not found, or failed to load");
|
alert("Model not found, or failed to load");
|
||||||
}
|
}
|
||||||
}
|
} else if (exampleFilename) {
|
||||||
if (filename) {
|
|
||||||
try {
|
try {
|
||||||
const model_bytes = await get_documentation_model(filename);
|
const model_bytes = await get_documentation_model(exampleFilename);
|
||||||
const importedModel = Model.from_bytes(model_bytes);
|
const importedModel = Model.from_bytes(model_bytes);
|
||||||
localStorage.removeItem("selected");
|
localStorage.removeItem("selected");
|
||||||
setModel(importedModel);
|
setModel(importedModel);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert("Model not found, or failed to load");
|
alert("Example file not found, or failed to load");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// try to load from local storage
|
// try to load from local storage
|
||||||
|
|||||||
Reference in New Issue
Block a user