mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-19 18:02:13 +00:00
27 lines
743 B
TypeScript
27 lines
743 B
TypeScript
// Copyright (C) 2017-2025 Smart code 203358507
|
|
|
|
import { useCallback } from 'react';
|
|
import { useServices } from 'stremio/services';
|
|
import useProfile from './useProfile';
|
|
|
|
const useSettings = (): [Settings, (settings: Settings) => void] => {
|
|
const { core } = useServices();
|
|
const profile = useProfile();
|
|
|
|
const updateSettings = useCallback((settings: Settings) => {
|
|
core.transport.dispatch({
|
|
action: 'Ctx',
|
|
args: {
|
|
action: 'UpdateSettings',
|
|
args: {
|
|
...profile.settings,
|
|
...settings
|
|
}
|
|
}
|
|
});
|
|
}, [profile]);
|
|
|
|
return [profile.settings, updateSettings];
|
|
};
|
|
|
|
export default useSettings;
|