chore: update masto (#506)
Co-authored-by: userquin <userquin@gmail.com>
This commit is contained in:
parent
8d57cfc886
commit
bae4ad7d4a
6 changed files with 105 additions and 52 deletions
|
@ -96,17 +96,7 @@ async function loginTo(user?: Omit<UserLogin, 'account'> & { account?: AccountCr
|
|||
return masto
|
||||
}
|
||||
|
||||
export async function removePushNotifications(user: UserLogin, fromSWPushManager = true) {
|
||||
if (!useRuntimeConfig().public.pwaEnabled || !user.pushSubscription)
|
||||
return
|
||||
|
||||
// unsubscribe push notifications
|
||||
try {
|
||||
await useMasto().pushSubscriptions.remove()
|
||||
}
|
||||
catch {
|
||||
// ignore
|
||||
}
|
||||
export async function removePushNotificationData(user: UserLogin, fromSWPushManager = true) {
|
||||
// clear push subscription
|
||||
user.pushSubscription = undefined
|
||||
const { acct } = user.account
|
||||
|
@ -130,6 +120,19 @@ export async function removePushNotifications(user: UserLogin, fromSWPushManager
|
|||
}
|
||||
}
|
||||
|
||||
export async function removePushNotifications(user: UserLogin) {
|
||||
if (!useRuntimeConfig().public.pwaEnabled || !user.pushSubscription)
|
||||
return
|
||||
|
||||
// unsubscribe push notifications
|
||||
try {
|
||||
await useMasto().pushSubscriptions.remove()
|
||||
}
|
||||
catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
export async function signout() {
|
||||
// TODO: confirm
|
||||
if (!currentUser.value)
|
||||
|
@ -149,6 +152,8 @@ export async function signout() {
|
|||
|
||||
await removePushNotifications(currentUser.value)
|
||||
|
||||
await removePushNotificationData(currentUser.value)
|
||||
|
||||
currentUserId.value = ''
|
||||
// Remove the current user from the users
|
||||
users.value.splice(index, 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue