fix(ui):Error pops up when enabling disabled client (#2594)

* fix(ui):Error pops up when enabling disabled client

Action is prevented and a clear message is displayed in Web UI

* fix formatting

* fix type issue

* fix formatting

---------

Co-authored-by: Bernd Storath <999999bst@gmail.com>
This commit is contained in:
Felipe Cordova Huenupil 2026-05-04 03:21:18 -04:00 committed by GitHub
parent ebcc42cc49
commit 05c655ede9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,19 @@ export default definePermissionEventHandler(
const client = await Database.clients.get(clientId);
checkPermissions(client);
if (
client &&
client.expiresAt !== null &&
new Date() > new Date(client.expiresAt)
) {
throw createError({
statusCode: 422,
statusMessage:
'Client is expired. Please update the expiration date first.',
message: 'Client is expired. Please update the expiration date first.',
});
}
await Database.clients.toggle(clientId, true);
await WireGuard.saveConfig();
return { success: true };