fixed minor socket connection issues
This commit is contained in:
1 parent
9a26fc46d5
commit
ea86f7f763
4 files changed
+76
-10
No files matched your search
@@ -8,8 +8,16 @@ export type MockHAEntitiesProps =
|
||||
}
|
||||
| {
|
||||
loading: false;
|
||||
error?: false;
|
||||
entities: HassEntities;
|
||||
entitySource: Record<string, EntitySource>;
|
||||
}
|
||||
| {
|
||||
loading: false;
|
||||
error: {
|
||||
entities: any;
|
||||
entitySource: any;
|
||||
};
|
||||
};
|
||||
export const useMockHAEntities = (args: MockHAEntitiesProps) => {
|
||||
if (args.loading) {
|
||||
@@ -23,7 +31,7 @@ export const useMockHAEntities = (args: MockHAEntitiesProps) => {
|
||||
ready: false,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
} else if (!args.error) {
|
||||
return createHAEntitiesState(
|
||||
{
|
||||
additional: {},
|
||||
@@ -36,5 +44,18 @@ export const useMockHAEntities = (args: MockHAEntitiesProps) => {
|
||||
collection: args.entitySource,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return createHAEntitiesState(
|
||||
{
|
||||
additional: {},
|
||||
ready: false,
|
||||
error: args.error.entities,
|
||||
},
|
||||
{
|
||||
additional: {},
|
||||
ready: false,
|
||||
error: args.error.entitySource,
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user