feat: added a profile settings and settings nav (#432)

This commit is contained in:
Ayaka Rizumu 2022-12-26 16:50:11 +08:00 committed by GitHub
parent c8a7e6e7e7
commit 613c5315b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 698 additions and 7 deletions

View file

@ -103,6 +103,24 @@ async function loginTo(user?: Omit<UserLogin, 'account'> & { account?: AccountCr
return masto
}
export function setAccountInfo(userId: string, account: AccountCredentials) {
const index = getUsersIndexByUserId(userId)
if (index === -1)
return false
users.value[index].account = account
return true
}
export async function pullMyAccountInfo() {
const me = await useMasto().accounts.verifyCredentials()
setAccountInfo(currentUserId.value, me)
}
export function getUsersIndexByUserId(userId: string) {
return users.value.findIndex(u => u.account?.id === userId)
}
export async function removePushNotificationData(user: UserLogin, fromSWPushManager = true) {
// clear push subscription
user.pushSubscription = undefined