wow there are no type errors
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
b23c8a2dbd
commit
9928b89c8f
1 changed files with 8 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import { patchMeSuccess } from 'soapbox/actions/me';
|
||||
import { useAppDispatch, useClient, useOwnAccount } from 'soapbox/hooks';
|
||||
import { useAppDispatch, useClient } from 'soapbox/hooks';
|
||||
import toast from 'soapbox/toast';
|
||||
|
||||
type IAccount = {
|
||||
|
@ -33,18 +33,19 @@ type UpdateCredentialsData = {
|
|||
}
|
||||
|
||||
const useUpdateCredentials = () => {
|
||||
const { account } = useOwnAccount();
|
||||
// const { account } = useOwnAccount();
|
||||
const client = useClient();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (data: UpdateCredentialsData) => client.settings.updateCredentials(data),
|
||||
onMutate(variables) {
|
||||
const cachedAccount = account;
|
||||
dispatch(patchMeSuccess({ ...account, ...variables }));
|
||||
// TODO: What is it intended to do?
|
||||
// onMutate(variables) {
|
||||
// const cachedAccount = account;
|
||||
// dispatch(patchMeSuccess({ ...account, ...variables }));
|
||||
|
||||
return { cachedAccount };
|
||||
},
|
||||
// return { cachedAccount };
|
||||
// },
|
||||
onSuccess(response) {
|
||||
dispatch(patchMeSuccess(response));
|
||||
toast.success('Chat Settings updated successfully');
|
||||
|
|
Loading…
Reference in a new issue