feat: added a profile settings and settings nav (#432)
This commit is contained in:
parent
c8a7e6e7e7
commit
613c5315b3
23 changed files with 698 additions and 7 deletions
|
@ -14,6 +14,7 @@ const scopes = [
|
|||
'Account',
|
||||
'Languages',
|
||||
'Switch account',
|
||||
'Settings',
|
||||
] as const
|
||||
|
||||
export type CommandScopeNames = typeof scopes[number]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -31,6 +31,8 @@ export const useIsMac = () => computed(() =>
|
|||
useRequestHeaders(['user-agent'])['user-agent']?.includes('Macintosh')
|
||||
?? navigator?.platform?.includes('Mac') ?? false)
|
||||
|
||||
export const isEmptyObject = (object: Object) => Object.keys(object).length === 0
|
||||
|
||||
export function removeHTMLTags(str: string) {
|
||||
return str.replaceAll(HTMLTagRE, '')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue