Format & fix lint

pull/751/head
nimbleghost 2023-06-13 14:02:54 +02:00
parent 8ccfa5c3fb
commit 390d42c607
6 changed files with 13 additions and 11 deletions

View File

@ -132,7 +132,6 @@ class Api {
}); });
} }
async deleteWebPush(pushSubscription) { async deleteWebPush(pushSubscription) {
const user = await userManager.get(config.base_url); const user = await userManager.get(config.base_url);
const url = accountWebPushUrl(config.base_url); const url = accountWebPushUrl(config.base_url);
@ -141,7 +140,7 @@ class Api {
method: "DELETE", method: "DELETE",
headers: maybeWithAuth({}, user), headers: maybeWithAuth({}, user),
body: JSON.stringify({ body: JSON.stringify({
endpoint: pushSubscription.endpoint endpoint: pushSubscription.endpoint,
}), }),
}); });
} }

View File

@ -1,8 +1,8 @@
import db from "./db"; import db from "./db";
class Prefs { class Prefs {
constructor(db) { constructor(dbImpl) {
this.db = db; this.db = dbImpl;
} }
async setSound(sound) { async setSound(sound) {

View File

@ -5,8 +5,8 @@ import db from "./db";
import { topicUrl } from "./utils"; import { topicUrl } from "./utils";
class SubscriptionManager { class SubscriptionManager {
constructor(db) { constructor(dbImpl) {
this.db = db; this.db = dbImpl;
} }
/** All subscriptions, including "new count"; this is a JOIN, see https://dexie.org/docs/API-Reference#joining */ /** All subscriptions, including "new count"; this is a JOIN, see https://dexie.org/docs/API-Reference#joining */
@ -124,7 +124,6 @@ class SubscriptionManager {
} else { } else {
await api.deleteWebPush(browserSubscription); await api.deleteWebPush(browserSubscription);
} }
} }
async updateState(subscriptionId, state) { async updateState(subscriptionId, state) {

View File

@ -2,8 +2,8 @@ import db from "./db";
import session from "./Session"; import session from "./Session";
class UserManager { class UserManager {
constructor(db) { constructor(dbImpl) {
this.db = db; this.db = dbImpl;
} }
async all() { async all() {

View File

@ -26,6 +26,6 @@ export const dbAsync = async () => {
return createDatabase(username); return createDatabase(username);
}; };
export const db = () => createDatabase(session.username()); const db = () => createDatabase(session.username());
export default db; export default db;

View File

@ -247,7 +247,11 @@ const WebPushEnabled = () => {
} }
return ( return (
<Pref labelId={labelId} title={t("prefs_notifications_web_push_title")} description={enabled ? t("prefs_notifications_web_push_enabled_description") : t("prefs_notifications_web_push_disabled_description")}> <Pref
labelId={labelId}
title={t("prefs_notifications_web_push_title")}
description={enabled ? t("prefs_notifications_web_push_enabled_description") : t("prefs_notifications_web_push_disabled_description")}
>
<FormControl fullWidth variant="standard" sx={{ m: 1 }}> <FormControl fullWidth variant="standard" sx={{ m: 1 }}>
<Select value={enabled ?? false} onChange={handleChange} aria-labelledby={labelId}> <Select value={enabled ?? false} onChange={handleChange} aria-labelledby={labelId}>
<MenuItem value>{t("prefs_notifications_web_push_enabled")}</MenuItem> <MenuItem value>{t("prefs_notifications_web_push_enabled")}</MenuItem>