forked from OpenWF/SpaceNinjaServer
		
	fix(webui): handle config get request failing due to expired authz (#1716)
Reviewed-on: OpenWF/SpaceNinjaServer#1716 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									bc5dc02fc9
								
							
						
					
					
						commit
						6394adb0f0
					
				@ -1315,7 +1315,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
 | 
			
		||||
    interval = setInterval(() => {
 | 
			
		||||
        if (window.authz) {
 | 
			
		||||
            clearInterval(interval);
 | 
			
		||||
            fetch("/custom/config?" + window.authz).then(res => {
 | 
			
		||||
            fetch("/custom/config?" + window.authz).then(async res => {
 | 
			
		||||
                if (res.status == 200) {
 | 
			
		||||
                    $("#server-settings-no-perms").addClass("d-none");
 | 
			
		||||
                    $("#server-settings").removeClass("d-none");
 | 
			
		||||
@ -1335,8 +1335,16 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
 | 
			
		||||
                        })
 | 
			
		||||
                    );
 | 
			
		||||
                } else {
 | 
			
		||||
                    $("#server-settings-no-perms").removeClass("d-none");
 | 
			
		||||
                    $("#server-settings").addClass("d-none");
 | 
			
		||||
                    if ((await res.text()) == "Log-in expired") {
 | 
			
		||||
                        revalidateAuthz(() => {
 | 
			
		||||
                            if (single.getCurrentPath() == "/webui/cheats") {
 | 
			
		||||
                                single.loadRoute("/webui/cheats");
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
                    } else {
 | 
			
		||||
                        $("#server-settings-no-perms").removeClass("d-none");
 | 
			
		||||
                        $("#server-settings").addClass("d-none");
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user