Skip to content

Commit 9ccfef6

Browse files
committed
fix(web): add typecheck script and update run() API usage
1 parent 84e10f2 commit 9ccfef6

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build",
8+
"build": "tsc --noEmit && vite build",
9+
"typecheck": "tsc --noEmit",
910
"preview": "vite preview"
1011
},
1112
"dependencies": {

web/src/AbuseSettings.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,19 @@ export function AbuseSettings() {
108108
}, [enabled, cats, custom, alertMin, saved]);
109109

110110
const save = () =>
111-
run("save", async () => {
112-
await saveAbuseSettings({
113-
enabled,
114-
categories: cats,
115-
custom,
116-
alert_min: alertMin,
117-
});
118-
notifySuccess("Настройки блоклистов сохранены");
119-
await load();
120-
}).catch((e) => notifyError(errMessage(e)));
111+
run(
112+
async () => {
113+
await saveAbuseSettings({
114+
enabled,
115+
categories: cats,
116+
custom,
117+
alert_min: alertMin,
118+
});
119+
notifySuccess("Настройки блоклистов сохранены");
120+
await load();
121+
},
122+
{ key: "save" },
123+
);
121124

122125
const cancel = () => {
123126
setEnabled(saved.enabled);
@@ -127,12 +130,15 @@ export function AbuseSettings() {
127130
};
128131

129132
const doRefresh = () =>
130-
run("refresh", async () => {
131-
await refreshAbuseFeeds();
132-
notifySuccess("Обновление списков запущено — займёт до минуты");
133-
// The download runs in the background; re-read status shortly after.
134-
window.setTimeout(() => load().catch(() => {}), 8000);
135-
}).catch((e) => notifyError(errMessage(e)));
133+
run(
134+
async () => {
135+
await refreshAbuseFeeds();
136+
notifySuccess("Обновление списков запущено — займёт до минуты");
137+
// The download runs in the background; re-read status shortly after.
138+
window.setTimeout(() => load().catch(() => {}), 8000);
139+
},
140+
{ key: "refresh" },
141+
);
136142

137143
if (!loaded) return <CenterLoader />;
138144

0 commit comments

Comments
 (0)