fix(native): protectedDevices store — unwrap response shape
Backend GET /api/devices/protected returns:
{ success, data: { devices, plan, max, isLegend } }
apiFetch already unwraps `data`, leaving us with the object
{ devices, plan, max, isLegend } — not an array.
Old code did `Array.isArray(res) ? res : []` on that object, which
silently fell through to an empty list. Effect: enrolled protected
devices (Mac/Windows) never appeared in the Geräte screen even though
the DB row existed and the API responded correctly.
Fix: read res.devices instead of assuming the response is the array.
This commit is contained in:
parent
db7875fb34
commit
8851f36f65
@ -36,8 +36,8 @@ export const useProtectedDevicesStore = create<ProtectedDevicesState>((set, get)
|
||||
load: async () => {
|
||||
set({ loading: true });
|
||||
try {
|
||||
const res = await apiFetch<ProtectedDevice[]>('/api/devices/protected');
|
||||
set({ devices: Array.isArray(res) ? res : [] });
|
||||
const res = await apiFetch<{ devices?: ProtectedDevice[] }>('/api/devices/protected');
|
||||
set({ devices: Array.isArray(res?.devices) ? res.devices : [] });
|
||||
} catch {
|
||||
// endpoint might not be ready yet — keep empty state, screen handles it
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user