fix(auth): use restUrl for modal-login under plain permalinks

Local WP has empty permalink_structure so /wp-json/* 404s on Apache.
modal-auth fell back to /wp-json/aksrt/v1; prefer aksrtData.restUrl
(index.php?rest_route=/aksrt/v1) and join paths correctly.
This commit is contained in:
kate522 committed 2026-07-25 11:02:32 +08:00
1 parent d3cae1f1cb
commit 7daaa03417
3 files changed
+57 -4

No files matched your search

+5 -1
View File
@@ -8,7 +8,11 @@
(function () {
'use strict';
var API_ROOT = (window.aksrtData && window.aksrtData.apiUrl) || '/wp-json/aksrt/v1';
var API_ROOT = (function () {
var d = window.aksrtData || {};
var raw = d.apiUrl || d.restUrl || d.rest_url || '/index.php?rest_route=/aksrt/v1';
return String(raw).replace(/\/$/, '');
})();
var NONCE = (window.aksrtData && window.aksrtData.restNonce) || '';
function initFollowButtons() {