fix: reset trial eligibility from web admin

This commit is contained in:
3252a8
2026-06-01 19:30:16 +03:00
parent 74272039c5
commit 687fc03e8c
16 changed files with 253 additions and 32 deletions
+5 -2
View File
@@ -469,8 +469,11 @@ export function createUsersStore({ api, onToast, at, routePrefix = "" }) {
state.update((st) => ({ ...st, userActionBusy: true }));
try {
const res = await api(`/admin/users/${s.openedUser.user_id}/reset-trial`, { method: "POST" });
if (res?.ok) onToast(at("trial_reset", {}, "Триал сброшен"));
else onToast(res?.error || at("error", {}, "Ошибка"));
if (res?.ok) {
onToast(at("trial_reset", {}, "Триал сброшен"));
await openUser(s.openedUser.user_id, { skipPush: true, pathContext: _pathContext });
if (_activeRef === "users") await loadUsers();
} else onToast(res?.error || at("error", {}, "Ошибка"));
} finally {
state.update((st) => ({ ...st, userActionBusy: false }));
}