Fix: use USER_URL for get users, PROFILE_URL for save
This commit is contained in:
+5
-4
@@ -17,7 +17,8 @@ function setCookie(name, value, days) {
|
|||||||
|
|
||||||
const API_URL = 'https://n8n.odoo4projects.com/webhook/paraguay/login';
|
const API_URL = 'https://n8n.odoo4projects.com/webhook/paraguay/login';
|
||||||
const NEWSLETTER_URL = 'https://n8n.odoo4projects.com/webhook/paraguay/newsletter';
|
const NEWSLETTER_URL = 'https://n8n.odoo4projects.com/webhook/paraguay/newsletter';
|
||||||
const PROFILE_URL = 'https://n8n.odoo4projects.com/webhook/paraguay/user';
|
const USER_URL = 'https://n8n.odoo4projects.com/webhook/paraguay/user';
|
||||||
|
const PROFILE_URL = 'https://n8n.odoo4projects.com/webhook/paraguay/profile';
|
||||||
|
|
||||||
function checkSession() {
|
function checkSession() {
|
||||||
const sessionid = getCookie('sessionid');
|
const sessionid = getCookie('sessionid');
|
||||||
@@ -215,9 +216,9 @@ async function subscribeNewsletter() {
|
|||||||
async function loadUsers() {
|
async function loadUsers() {
|
||||||
const usersContainer = document.getElementById('users-list');
|
const usersContainer = document.getElementById('users-list');
|
||||||
if (!usersContainer) return;
|
if (!usersContainer) return;
|
||||||
console.log('loadUsers: starting fetch from', PROFILE_URL);
|
console.log('loadUsers: starting fetch from', USER_URL);
|
||||||
try {
|
try {
|
||||||
const response = await fetch(PROFILE_URL);
|
const response = await fetch(USER_URL);
|
||||||
console.log('loadUsers: response status =', response.status);
|
console.log('loadUsers: response status =', response.status);
|
||||||
if (!response.ok) throw new Error('Failed to fetch users');
|
if (!response.ok) throw new Error('Failed to fetch users');
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
@@ -264,7 +265,7 @@ async function openProfileModal() {
|
|||||||
const sessionid = getCookie('sessionid');
|
const sessionid = getCookie('sessionid');
|
||||||
if (!sessionid) { alert('Bitte melden Sie sich an.'); return; }
|
if (!sessionid) { alert('Bitte melden Sie sich an.'); return; }
|
||||||
try {
|
try {
|
||||||
const response = await fetch(PROFILE_URL + '?sessionid=' + encodeURIComponent(sessionid));
|
const response = await fetch(USER_URL + '?sessionid=' + encodeURIComponent(sessionid));
|
||||||
console.log('openProfileModal response:', response.status, await response.clone().json());
|
console.log('openProfileModal response:', response.status, await response.clone().json());
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const user = await response.json();
|
const user = await response.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user