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:
committed by
GitHub
parent
ebcc42cc49
commit
05c655ede9
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user