Обновить index.html
This commit is contained in:
@@ -32,16 +32,18 @@
|
||||
const errorEl = document.getElementById('error');
|
||||
errorEl.style.display = 'none';
|
||||
|
||||
const username = document.getElementById('username').value;
|
||||
const password = document.getElementById('password').value;
|
||||
let username = document.getElementById('username').value;
|
||||
let password = document.getElementById('password').value;
|
||||
|
||||
console.log(username + password)
|
||||
let json = JSON.stringify({ username, password, deviceId: 'stub-device', publicKey: 'N6fByS7oTIOX6m7on8h6T093SOn3df67o6v6n6n6n6o=' }),
|
||||
try {
|
||||
// 1. Делаем реальный запрос к вашему API Gateway
|
||||
const response = await fetch('https://api.dev.lendry.ru/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
// Добавил device_id и public_key (как требует ваш auth.proto)
|
||||
body: JSON.stringify({ username, password, deviceId: 'stub-device', publicKey: 'N6fByS7oTIOX6m7on8h6T093SOn3df67o6v6n6n6n6o=' }),
|
||||
body: json,
|
||||
// КРИТИЧЕСКИ ВАЖНО: заставляет браузер сохранить куку refreshToken
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user