Minor fixes for frontend on shuffle with no internet

This commit is contained in:
Frikky
2025-05-20 18:48:52 +02:00
parent c2c4a9c323
commit 065f6f9332
4 changed files with 23 additions and 6 deletions
+1 -1
View File
@@ -463,7 +463,7 @@ const App = (message, props) => {
<Route <Route
exact exact
path="/AdminSetup" path="/adminsetup"
element={ element={
<AdminSetup <AdminSetup
isLoaded={isLoaded} isLoaded={isLoaded}
+9 -3
View File
@@ -68,13 +68,19 @@ const AdminAccount = (props) => {
.then((response) => .then((response) =>
response.json().then((responseJson) => { response.json().then((responseJson) => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"])
if (responseJson?.reason?.toLowerCase().includes("connection refused")) {
navigate("/loginsetup")
}
} else { } else {
if (responseJson.reason === "redirect") { if (responseJson.reason === "redirect") {
setTimeout(() => { setTimeout(() => {
window.location.pathname = "/login"; window.location.pathname = "/login"
}, 2500) }, 2500)
} }
} }
}) })
) )
@@ -111,7 +117,7 @@ const AdminAccount = (props) => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"]);
} else { } else {
setLoginInfo("Successful register :)"); setLoginInfo("Successful register! Redirecting in a moment...");
setTimeout(() => { setTimeout(() => {
window.location.pathname = "/login"; window.location.pathname = "/login";
+6 -1
View File
@@ -361,7 +361,7 @@ const LoginPage = props => {
console.log("Should login instead of register!") console.log("Should login instead of register!")
setRegister(!register) setRegister(!register)
} else { } else {
console.log("Path: " + path, "Register: " + register) //console.log("Path: " + path, "Register: " + register)
} }
} }
@@ -468,6 +468,11 @@ const LoginPage = props => {
response.json().then((responseJson) => { response.json().then((responseJson) => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"]);
if (responseJson?.reason?.toLowerCase().includes("connection refused")) {
navigate("/loginsetup")
}
} else { } else {
if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) { if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) {
setSSOUrl(responseJson.sso_url); setSSOUrl(responseJson.sso_url);
+7 -1
View File
@@ -85,7 +85,13 @@ const LoginDialog = (props) => {
.then((response) => .then((response) =>
response.json().then((responseJson) => { response.json().then((responseJson) => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setLoginInfo(responseJson["reason"]); setLoginInfo(responseJson["reason"])
if (responseJson?.reason?.toLowerCase().includes("connection refused")) {
setLoginViewLoading(true)
start()
}
} else { } else {
if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) { if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) {