2024-01-30 21:03:11 +08:00
|
|
|
import { useCallback } from 'react';
|
|
|
|
import { useMutation } from '@apollo/client';
|
|
|
|
import { USER_CHANGED_LOCAL_SETTINGS } from './mutations';
|
|
|
|
|
|
|
|
const useUserChangedLocalSettings = () => {
|
|
|
|
const [userChangedLocalSettings] = useMutation(USER_CHANGED_LOCAL_SETTINGS);
|
|
|
|
|
2024-01-30 22:07:10 +08:00
|
|
|
const setLocalSettings = (settings: Record<string, unknown>) => {
|
2024-01-30 21:03:11 +08:00
|
|
|
return userChangedLocalSettings({
|
|
|
|
variables: {
|
2024-07-05 04:00:06 +08:00
|
|
|
settings,
|
2024-01-30 21:03:11 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return useCallback(setLocalSettings, [userChangedLocalSettings]);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default useUserChangedLocalSettings;
|