-
Notifications
You must be signed in to change notification settings - Fork 506
User: Use push functionality in webbrowsers - refs #3255 #6421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js" | ||
import axios from "axios" | ||
|
||
export function usePushSubscription() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function usePushSubscription
has 187 lines of code (exceeds 25 allowed). Consider refactoring.
return true | ||
} catch (e) { | ||
console.error("Push subscription error:", e) | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return
statements within this function.
} | ||
} | ||
|
||
async function checkSubscription(userId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function checkSubscription
has 57 lines of code (exceeds 25 allowed). Consider refactoring.
} | ||
} | ||
|
||
async function unsubscribe(userId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function unsubscribe
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
} | ||
} | ||
|
||
async function subscribe(userId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function subscribe
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js" | ||
import axios from "axios" | ||
|
||
export function usePushSubscription() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function usePushSubscription
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
loading.value = true | ||
|
||
try { | ||
if (!userId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
return false | ||
} | ||
|
||
if (!("serviceWorker" in navigator) || !("PushManager" in window)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
} | ||
} | ||
|
||
async function checkSubscription(userId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function checkSubscription
has 64 lines of code (exceeds 25 allowed). Consider refactoring.
import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js" | ||
import axios from "axios" | ||
|
||
export function usePushSubscription() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function usePushSubscription
has 194 lines of code (exceeds 25 allowed). Consider refactoring.
import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js" | ||
import axios from "axios" | ||
|
||
export function usePushSubscription() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function usePushSubscription
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Code Climate has analyzed commit 5e5250c and detected 10 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
No description provided.