feat(frontend): Refactor auth and split into separate files

This commit is contained in:
2025-10-03 09:17:03 +02:00
parent 6c88b4fd96
commit a2b80d42ae
9 changed files with 229 additions and 189 deletions

View File

@@ -1,5 +1,5 @@
import type { RouteLocationRaw } from '#vue-router'
import type { useAuth } from '~/composables/useAuth'
import type { useAuthClient } from '~/composables/auth/useAuthClient'
export interface RuntimeAuthConfig {
redirectUserTo: RouteLocationRaw | string
@@ -7,7 +7,7 @@ export interface RuntimeAuthConfig {
}
// Types can be found here: https://github.com/better-auth/better-auth/blob/3f574ec70bb15c155a78673d42c5e25f7376ced3/packages/better-auth/src/plugins/organization/routes/crud-invites.ts#L531
type Client = ReturnType<typeof useAuth>['client']
type Client = ReturnType<typeof useAuthClient>['client']
export type Session = Client['$Infer']['Session']
export type User = Session['user']
export type ActiveOrganization = Client['$Infer']['ActiveOrganization']
@@ -15,7 +15,7 @@ export type Organization = Client['$Infer']['Organization']
export type Invitation = Client['$Infer']['Invitation']
export type Member = Client['$Infer']['Member']
export type ListMembersOptions = Parameters<Client['organization']['listMembers']>[0]
export type ListMembersResponse = Awaited<ReturnType<Client['organization']['listMembers']>>
export type ListMembersResponse = Awaited<ReturnType<Client['organization']['listMembers']>>['data']
export type ListMembersQuery = NonNullable<ListMembersOptions>['query']
// Extended invitation type with additional organization and inviter details
export type CustomInvitation =
@@ -24,4 +24,4 @@ export type CustomInvitation =
organizationSlug: string
inviterEmail: string
})
| null
| null