Fix dynamic API base path for server deployment
This commit is contained in:
+2
-1
@@ -798,7 +798,8 @@ async function changeStatus(id, status) {
|
||||
async function generateLink(id) {
|
||||
try {
|
||||
const data = await API.post('surveys.php?action=generateLink', { id });
|
||||
const fullUrl = data.full_url || `${window.location.origin}/survey/respond.php?link=${data.unique_link}`;
|
||||
const basePath = window.location.pathname.includes('/survey') ? '/survey' : '';
|
||||
const fullUrl = data.full_url || `${window.location.origin}${basePath}/respond.php?link=${data.unique_link}`;
|
||||
|
||||
// Find survey title
|
||||
const survey = surveysList.find(s => s.id == id);
|
||||
|
||||
Reference in New Issue
Block a user