@andrey4emk/npm-app-back-b24 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bitrix24/b24.js +4 -1
  2. package/package.json +1 -1
package/bitrix24/b24.js CHANGED
@@ -90,7 +90,8 @@ export class B24Prepared {
90
90
  try {
91
91
  const { access_token, refresh_token, domain, expires_in, member_id } = req.body;
92
92
  if (!access_token || !refresh_token || !domain || !expires_in || !member_id) {
93
- return res.status(400).json({ status: "error", message: "Не заполнены обязательные поля." });
93
+ res.status(400).json({ status: "error", message: "Не заполнены обязательные поля." });
94
+ return { error: true, message: "Не заполнены обязательные поля." }; // <-- ДОБАВИТЬ
94
95
  }
95
96
  // Если домен начинается с https:// или http:// убираем эту часть
96
97
  let domainClean = domain.replace("https://", "").replace("http://", "");
@@ -102,8 +103,10 @@ export class B24Prepared {
102
103
  member_id,
103
104
  });
104
105
  res.status(201).json({ status: "ok", message: "Сохранили токены. Перезапустите сервер для применения." });
106
+ return { error: false, message: "Токены сохранены из фронта." }; // <-- ДОБАВИТЬ
105
107
  } catch (error) {
106
108
  res.status(500).json({ status: "error", message: "Не удалось сохранить токен." });
109
+ return { error: true, message: `Не удалось сохранить токен: ${error.message}` }; // <-- ДОБАВИТЬ
107
110
  }
108
111
  }
109
112
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrey4emk/npm-app-back-b24",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "Bitrix24 OAuth helpers for Node.js projects",
5
5
  "main": "index.js",
6
6
  "type": "module",