mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-08-05 06:50:10 +00:00
feat: add device selection and removal functionality in SecurityDevicesPage
This commit is contained in:
@@ -885,6 +885,20 @@ export async function deleteAuthorizedDevice(
|
||||
if (!resp.ok) throw new Error(t('txt_remove_device_failed'));
|
||||
}
|
||||
|
||||
export async function deleteAuthorizedDevices(
|
||||
authedFetch: AuthedFetch,
|
||||
devices: Array<Pick<AuthorizedDevice, 'identifier' | 'hasStoredDevice'>>
|
||||
): Promise<void> {
|
||||
const uniqueDevices = Array.from(
|
||||
new Map(devices.map((device) => [String(device.identifier || '').trim(), device])).values()
|
||||
).filter((device) => String(device.identifier || '').trim());
|
||||
await Promise.all(uniqueDevices.map((device) => (
|
||||
device.hasStoredDevice === false
|
||||
? revokeAuthorizedDeviceTrust(authedFetch, device.identifier)
|
||||
: deleteAuthorizedDevice(authedFetch, device.identifier)
|
||||
)));
|
||||
}
|
||||
|
||||
export async function updateAuthorizedDeviceName(
|
||||
authedFetch: AuthedFetch,
|
||||
deviceIdentifier: string,
|
||||
|
||||
Reference in New Issue
Block a user