u
This commit is contained in:
@@ -53,7 +53,7 @@ async function fetchAllBrands() {
|
||||
let offset = 0;
|
||||
let total = Infinity;
|
||||
const collected = [];
|
||||
for (;;) {
|
||||
for (; ;) {
|
||||
const res = await brandApi.list({ offset, limit: FETCH_PAGE_SIZE });
|
||||
if (offset === 0) total = Number(res.total ?? res.brands?.length ?? 0);
|
||||
const page = Array.isArray(res.brands) ? res.brands : [];
|
||||
@@ -155,7 +155,7 @@ const actions = {
|
||||
*/
|
||||
async addImage(id, file) {
|
||||
const res = await brandApi.addImage(id, file);
|
||||
await brandAutomat.actions.load();
|
||||
await brandAutomat.actions.reload();
|
||||
return res.brand;
|
||||
},
|
||||
|
||||
@@ -165,7 +165,7 @@ const actions = {
|
||||
*/
|
||||
async deleteImage(id) {
|
||||
const res = await brandApi.deleteImage(id);
|
||||
await brandAutomat.actions.load();
|
||||
await brandAutomat.actions.reload();
|
||||
return res.brand;
|
||||
},
|
||||
|
||||
@@ -202,12 +202,12 @@ sseAutomat.actions.on('brand', (event) => {
|
||||
if (payload && typeof payload.sender === 'string' && payload.sender) {
|
||||
try {
|
||||
if (payload.sender === getSseClientId()) return;
|
||||
} catch {}
|
||||
} catch { }
|
||||
}
|
||||
} catch {
|
||||
// Unparseable payload: fall through to reload.
|
||||
}
|
||||
void brandAutomat.actions.reload().catch(() => {});
|
||||
void brandAutomat.actions.reload().catch(() => { });
|
||||
});
|
||||
|
||||
export default brandAutomat;
|
||||
|
||||
Reference in New Issue
Block a user