Initial commit: Aurora Moments self-hosted photo/video sharing platform
Django/DRF + PostgreSQL/Redis/Celery backend with accounts, library, moments, and notifications apps; React/TypeScript/Vite frontend with Instagram-style sidebar nav, feed, profiles, nested comment replies, notifications, and photo/video upload with ffmpeg-generated posters. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { api, tokenStorage } from './client'
|
||||
import type { User } from './types'
|
||||
|
||||
interface TokenPair {
|
||||
access: string
|
||||
refresh: string
|
||||
}
|
||||
|
||||
export async function login(email: string, password: string): Promise<void> {
|
||||
const tokens = await api.post<TokenPair>('/api/auth/token/', { email, password })
|
||||
tokenStorage.set(tokens.access, tokens.refresh)
|
||||
}
|
||||
|
||||
export async function register(email: string, username: string, password: string): Promise<void> {
|
||||
await api.post<User>('/api/accounts/register/', { email, username, password })
|
||||
await login(email, password)
|
||||
}
|
||||
|
||||
export function logout(): void {
|
||||
tokenStorage.clear()
|
||||
}
|
||||
|
||||
export function getMe(): Promise<User> {
|
||||
return api.get<User>('/api/accounts/me/')
|
||||
}
|
||||
Reference in New Issue
Block a user