Fix Sub-Account Manager when used through P2P

cron-as-worker-process
Moe 2022-06-23 18:17:46 -07:00
parent 069c91d3cc
commit 4ceb8bb981
3 changed files with 6 additions and 4 deletions

View File

@ -74,8 +74,10 @@ function base64ArrayBuffer(arrayBuffer) {
function getLocationPathName(){
return location.pathname.endsWith('/') ? location.pathname : location.pathname + '/'
}
function getFullOrigin(){
return location.origin + getLocationPathName()
function getFullOrigin(withoutTrailingSlash){
var url = location.origin + getLocationPathName()
if(withoutTrailingSlash)url = url.slice(0, -1);
return url
}
function debugLog(...args){
console.log(...args)

View File

@ -1,5 +1,5 @@
$(document).ready(function(){
var apiPrefix = getAdminApiPrefix()
var apiPrefix = getFullOrigin(true) + getAdminApiPrefix()
var theWindow = $('#subAccountManager');
var accountTable = $('#subAccountsList tbody');
var theWindowForm = $('#monSectionAccountInformation');

View File

@ -65,7 +65,7 @@
if(!details.sub){ %>
<script>
window.getAdminApiPrefix = function(piece){
return location.search === '?p2p=1' ? (location.pathname.endsWith('/') ? location.pathname : location.pathname) : "<%=originalURL%><%=config.webPaths.adminApiPrefix%><%- $user.auth_token %>/"
return "<%=originalURL%><%=config.webPaths.adminApiPrefix%><%- $user.auth_token %>/"
}
</script>
<% }