zapishis-client/apps/web/components/auth/update-profile.tsx
Vlad Chikalkin 9314cdd1cb
merge branch 'refactor-api' (#23)
* refactor customer api

* refactor slots api

* hooks/customers: use invalidateQueries

* refactor services api

* optimize hooks queryKey

* refactor orders api

* typo refactor hooks

* fix telegramId type (number)

* fix bot with new api

* rename customers masters & clients query

* fix useClientsQuery & useMastersQuery query

* new line after 'use client' & 'use server' directives
2025-05-20 14:27:51 +03:00

26 lines
677 B
TypeScript

'use client';
import { useCustomerMutation } from '@/hooks/api/customers';
import { initData, useSignal } from '@telegram-apps/sdk-react';
import { useEffect, useState } from 'react';
export function UpdateProfile() {
const initDataUser = useSignal(initData.user);
const { mutate: updateProfile } = useCustomerMutation();
const [hasUpdated, setHasUpdated] = useState(false);
useEffect(() => {
if (!hasUpdated) {
updateProfile({
data: {
active: true,
photoUrl: initDataUser?.photoUrl || undefined,
},
});
setHasUpdated(true);
}
}, [hasUpdated, initDataUser?.photoUrl, updateProfile]);
return null;
}