mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-23 18:29:19 -05:00
refactor(webpush): remove redundant try-catch
Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me>
This commit is contained in:
@@ -55,18 +55,12 @@ export const verifyPushSubscription = async (
|
||||
|
||||
const endpoint = subscription.endpoint;
|
||||
|
||||
try {
|
||||
const { data } = await axios.get<UserPushSubscription>(
|
||||
`/api/v1/user/${userId}/pushSubscription/${encodeURIComponent(
|
||||
endpoint
|
||||
)}`
|
||||
);
|
||||
const { data } = await axios.get<UserPushSubscription>(
|
||||
`/api/v1/user/${userId}/pushSubscription/${encodeURIComponent(endpoint)}`
|
||||
);
|
||||
|
||||
return data.endpoint === endpoint;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
return data.endpoint === endpoint;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -85,18 +79,6 @@ export const verifyAndResubscribePushSubscription = async (
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
const { data: backendSubscriptions } = await axios.get<
|
||||
UserPushSubscription[]
|
||||
>(`/api/v1/user/${userId}/pushSubscriptions`);
|
||||
|
||||
if (backendSubscriptions.length > 0) {
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
// Continue with resubscribe logic
|
||||
}
|
||||
|
||||
if (currentSettings.enablePushRegistration) {
|
||||
try {
|
||||
// Unsubscribe from the backend to clear the existing push subscription (keys and endpoint)
|
||||
|
||||
Reference in New Issue
Block a user