don't apply data in connect method

This commit is contained in:
ppc
2024-08-13 20:52:50 +01:00
parent 2405ef3e14
commit c061b5fb2d
+3 -8
View File
@@ -11,20 +11,15 @@ export class AMServer extends Realm.Object<AMServer> implements AMServerInfoResp
createdAt: Date;
apiVersion: number;
async connect(abort?: AbortSignal | undefined): Promise<boolean> {
async connect(abort?: AbortSignal | undefined): Promise<AMServerInfoResponse> {
try {
const response = await fetch(this.serverAddress, {
signal: abort
});
const data: AMServerInfoResponse = await response.json();
this.lastUsed = new Date();
Object.apply(this, data);
return true;
return await response.json();
} catch {
return false;
return null;
}
}