base commit
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { createEffect, createEvent, createStore, sample } from 'effector'
|
||||
import { apiClient } from '@/shared/api/client'
|
||||
|
||||
export type AuthUser = { id: string; email: string; name?: string | null }
|
||||
export type AuthUser = { id: string; email: string; name?: string | null; phone?: string | null }
|
||||
|
||||
const TOKEN_KEY = 'craftshop_auth_token'
|
||||
|
||||
@@ -28,7 +28,9 @@ export const verifyEmailChangeFx = createEffect(async (params: { newEmail: strin
|
||||
return data.user
|
||||
})
|
||||
|
||||
export const updateProfileFx = createEffect(async (params: { name: string | null }) => {
|
||||
export type UpdateProfileParams = { name: string | null; phone?: string | null }
|
||||
|
||||
export const updateProfileFx = createEffect(async (params: UpdateProfileParams) => {
|
||||
const { data } = await apiClient.patch<{ user: AuthUser }>('me/profile', params)
|
||||
return data.user
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user