feat(users): fetch current user from backend
This commit is contained in:
+5
-3
@@ -1,4 +1,6 @@
|
||||
import { currentUser, mockUsers } from "@/lib/mock"
|
||||
import { httpJson } from "@/lib/api/http"
|
||||
import { mockUsers } from "@/lib/mock"
|
||||
import type { User } from "@/lib/types"
|
||||
|
||||
export function listUsers() {
|
||||
return mockUsers
|
||||
@@ -8,6 +10,6 @@ export function getUserById(userId: string) {
|
||||
return mockUsers.find((user) => user.id === userId)
|
||||
}
|
||||
|
||||
export function getCurrentUserForLogin() {
|
||||
return currentUser
|
||||
export async function getCurrentUserForLogin(): Promise<User> {
|
||||
return httpJson<User>("/api/v1/users/me")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user