Skip to content

Commit a5b8dc1

Browse files
refactor: simplify saveOrder method by using submit function for API call
1 parent dbc8eb7 commit a5b8dc1

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

internal/web/html/xui/inbounds.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,28 +1657,7 @@
16571657
},
16581658
async saveOrder() {
16591659
const ids = this.collectIds();
1660-
try {
1661-
const resp = await fetch('/panel/api/inbounds/reorder', {
1662-
method: 'POST',
1663-
headers: {
1664-
'Content-Type': 'application/json',
1665-
'X-Requested-With': 'XMLHttpRequest'
1666-
},
1667-
body: JSON.stringify({ids: ids}),
1668-
});
1669-
const data = await resp.json().catch(() => null);
1670-
if (data && data.success) {
1671-
if (this.$message) this.$message.success('{{ i18n "pages.inbounds.reordered" }}');
1672-
} else {
1673-
const msgText = data && data.msg ? data.msg : 'Reorder failed';
1674-
if (this.$message) this.$message.error(msgText);
1675-
await this.getDBInbounds();
1676-
}
1677-
} catch (e) {
1678-
console.error('reorder error', e);
1679-
if (this.$message) this.$message.error('somethingWentWrong');
1680-
await this.getDBInbounds();
1681-
}
1660+
await this.submit('/panel/api/inbounds/reorder', JSON.stringify({ids: ids}));
16821661
},
16831662
},
16841663
watch: {

0 commit comments

Comments
 (0)