feat: add shared UI package auth DI (#5720)
* feat: add shared UI package auth DI * use refs instead of reactive * pnpm prepr * move app auth provider setup to src/providers/setup
This commit is contained in:
12
packages/ui/src/providers/auth.ts
Normal file
12
packages/ui/src/providers/auth.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Labrinth } from '@modrinth/api-client/src/modules/labrinth/types'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
import { createContext } from './create-context'
|
||||
|
||||
export interface AuthProvider {
|
||||
session_token: Ref<string | null>
|
||||
user: Ref<Labrinth.Users.v2.User | null>
|
||||
requestSignIn: (redirectPath: string) => void | Promise<void>
|
||||
}
|
||||
|
||||
export const [injectAuth, provideAuth] = createContext<AuthProvider>('root', 'auth')
|
||||
@@ -1,5 +1,6 @@
|
||||
export * from './api-client'
|
||||
export * from './app-backup'
|
||||
export * from './auth'
|
||||
export * from './content-manager'
|
||||
export { createContext } from './create-context'
|
||||
export * from './file-picker'
|
||||
|
||||
Reference in New Issue
Block a user