mirror of
https://github.com/wg-easy/wg-easy.git
synced 2026-05-13 22:10:03 +00:00
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:
parent
ebcc42cc49
commit
05c655ede9
1 changed files with 13 additions and 0 deletions
|
|
@ -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 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue