mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 07:25:19 +02:00
more clean up
This commit is contained in:
parent
6100ab14c6
commit
56c78856f8
6 changed files with 2 additions and 33 deletions
|
@ -44,7 +44,6 @@ export default function RegisterPage() {
|
|||
}
|
||||
}
|
||||
|
||||
// _app.tsx will automatically redirect if not authenticated
|
||||
return (
|
||||
<>
|
||||
<Script
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import type { SharedType } from '@maybe-finance/shared'
|
||||
import {
|
||||
BrowserUtil,
|
||||
useAccountApi,
|
||||
useAccountContext,
|
||||
useUserApi,
|
||||
} from '@maybe-finance/client/shared'
|
||||
import { useAccountContext } from '@maybe-finance/client/shared'
|
||||
import { Menu } from '@maybe-finance/design-system'
|
||||
import { RiDeleteBin5Line, RiPencilLine, RiRefreshLine } from 'react-icons/ri'
|
||||
import { RiDeleteBin5Line, RiPencilLine } from 'react-icons/ri'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
type Props = {
|
||||
|
@ -14,13 +9,8 @@ type Props = {
|
|||
}
|
||||
|
||||
export function AccountMenu({ account }: Props) {
|
||||
const { useProfile } = useUserApi()
|
||||
const user = useProfile()
|
||||
const { editAccount, deleteAccount } = useAccountContext()
|
||||
const { useSyncAccount } = useAccountApi()
|
||||
|
||||
const router = useRouter()
|
||||
const syncAccount = useSyncAccount()
|
||||
|
||||
if (!account) return null
|
||||
|
||||
|
@ -33,15 +23,6 @@ export function AccountMenu({ account }: Props) {
|
|||
<Menu.Item icon={<RiPencilLine />} onClick={() => editAccount(account)}>
|
||||
Edit
|
||||
</Menu.Item>
|
||||
{BrowserUtil.hasRole(user, 'Admin') && (
|
||||
<Menu.Item
|
||||
icon={<RiRefreshLine />}
|
||||
destructive
|
||||
onClick={() => syncAccount.mutate(account.id)}
|
||||
>
|
||||
Sync
|
||||
</Menu.Item>
|
||||
)}
|
||||
{!account.accountConnectionId && (
|
||||
<Menu.Item
|
||||
icon={<RiDeleteBin5Line />}
|
||||
|
|
|
@ -13,8 +13,6 @@ const AuthUserApi = (axios: AxiosInstance) => ({
|
|||
|
||||
const staleTimes = {
|
||||
user: 30_000,
|
||||
netWorth: 30_000,
|
||||
insights: 30_000,
|
||||
}
|
||||
|
||||
export function useAuthUserApi() {
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
import type { User } from '@auth0/auth0-react'
|
||||
|
||||
export function hasRole(user: User | null | undefined, role: 'Admin'): boolean {
|
||||
if (!user) return false
|
||||
const roles = user['https://maybe.co/roles']
|
||||
return roles && Array.isArray(roles) && roles.includes(role)
|
||||
}
|
|
@ -2,4 +2,3 @@ export * from './image-loaders'
|
|||
export * from './browser-utils'
|
||||
export * from './account-utils'
|
||||
export * from './form-utils'
|
||||
export * from './auth-utils'
|
||||
|
|
|
@ -45,7 +45,6 @@ export class AuthUserService implements IAuthUserService {
|
|||
async delete(id: AuthUser['id']) {
|
||||
const authUser = await this.get(id)
|
||||
|
||||
// Delete user from prisma
|
||||
this.logger.info(`Removing user ${authUser.id} from Prisma`)
|
||||
const user = await this.prisma.authUser.delete({ where: { id } })
|
||||
return user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue