mirror of
https://github.com/1f349/admin.1f349.com.git
synced 2025-02-22 05:24:57 +00:00
Update rest table after item deletion
This commit is contained in:
parent
e278762629
commit
1581a7b810
Binary file not shown.
@ -16,7 +16,7 @@ export class RestTable<T extends object> implements IPromiseLike<RestTable<T>> {
|
|||||||
this.rows = [];
|
this.rows = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateSubs() {
|
updateSubs() {
|
||||||
this.subs.forEach(x => x(this));
|
this.subs.forEach(x => x(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ export class RestItem<T extends object> implements IPromiseLike<RestItem<T>> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateSubs() {
|
updateSubs() {
|
||||||
this.subs.forEach(x => x(this));
|
this.subs.forEach(x => x(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +138,7 @@ export class RestItem<T extends object> implements IPromiseLike<RestItem<T>> {
|
|||||||
const x = await LOGIN.clientRequest(this.keyUrl(), options);
|
const x = await LOGIN.clientRequest(this.keyUrl(), options);
|
||||||
if (x.status !== 200) throw new Error("Unexpected status code: " + x.status);
|
if (x.status !== 200) throw new Error("Unexpected status code: " + x.status);
|
||||||
this.table.rows = this.table.rows.filter(x_1 => this.table.keyFunc(x_1.data) !== this.key());
|
this.table.rows = this.table.rows.filter(x_1 => this.table.keyFunc(x_1.data) !== this.key());
|
||||||
|
this.table.updateSubs();
|
||||||
this.setLoading(false);
|
this.setLoading(false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.setErrorReason("Failed to remove item " + this.key());
|
this.setErrorReason("Failed to remove item " + this.key());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user