mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-28 20:39:35 +00:00
fix @d-buchmann bug: after scanning in Info mode, if Info mode is turned off when scanning a part that did not exist, it now redirects user to create part page
This commit is contained in:
parent
a39eeb47be
commit
b31cbf8234
2 changed files with 7 additions and 0 deletions
|
|
@ -143,6 +143,12 @@ export default class extends Controller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If info mode is OFF and part was NOT found, redirect to create part URL
|
||||||
|
if (!infoMode && !data.found && data.createUrl) {
|
||||||
|
window.location.assign(data.createUrl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise render returned fragment HTML
|
// Otherwise render returned fragment HTML
|
||||||
if (typeof data.html === "string" && data.html !== "") {
|
if (typeof data.html === "string" && data.html !== "") {
|
||||||
const el = document.getElementById("scan-augmented-result");
|
const el = document.getElementById("scan-augmented-result");
|
||||||
|
|
|
||||||
|
|
@ -382,6 +382,7 @@ class ScanController extends AbstractController
|
||||||
'ok' => true,
|
'ok' => true,
|
||||||
'found' => $targetFound,
|
'found' => $targetFound,
|
||||||
'redirectUrl' => $redirectUrl, // client redirects only when infoMode=false
|
'redirectUrl' => $redirectUrl, // client redirects only when infoMode=false
|
||||||
|
'createUrl' => $createUrl,
|
||||||
'html' => $html,
|
'html' => $html,
|
||||||
'infoMode' => $infoMode,
|
'infoMode' => $infoMode,
|
||||||
], 200);
|
], 200);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue