mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-21 15:53:50 +02:00
refactor: Splitting API requests from app.js (#1166)
* splitting API requests form app.js * fix: vip friends display issue
This commit is contained in:
@@ -297,14 +297,28 @@ export default class extends baseClass {
|
||||
};
|
||||
|
||||
API.bulk = function (options) {
|
||||
this[options.fn](options.params)
|
||||
.catch((err) => {
|
||||
if ('done' in options) {
|
||||
options.done.call(this, false, options);
|
||||
}
|
||||
throw err;
|
||||
})
|
||||
.then((args) => this.$bulk(options, args));
|
||||
// it's stupid, but I won't waste time on the 'this' context
|
||||
// works, that's enough.
|
||||
if (typeof options.fn === 'function') {
|
||||
options
|
||||
.fn(options.params)
|
||||
.catch((err) => {
|
||||
if ('done' in options) {
|
||||
options.done.call(this, false, options);
|
||||
}
|
||||
throw err;
|
||||
})
|
||||
.then((args) => this.$bulk(options, args));
|
||||
} else {
|
||||
this[options.fn](options.params)
|
||||
.catch((err) => {
|
||||
if ('done' in options) {
|
||||
options.done.call(this, false, options);
|
||||
}
|
||||
throw err;
|
||||
})
|
||||
.then((args) => this.$bulk(options, args));
|
||||
}
|
||||
};
|
||||
|
||||
API.statusCodes = {
|
||||
|
||||
Reference in New Issue
Block a user