19 lines
560 B
TypeScript
19 lines
560 B
TypeScript
export const useSettings = () => {
|
|
const currentPage = useState('settings-page', () => 'general');
|
|
const pageParams = useState('settings-params', () => [] as string[]);
|
|
|
|
const setPage = (id: string, params?: string | string[]) => {
|
|
currentPage.value = id;
|
|
if (params) {
|
|
if (typeof params === 'string') {
|
|
params = [params];
|
|
}
|
|
pageParams.value = params;
|
|
} else {
|
|
pageParams.value = [];
|
|
}
|
|
};
|
|
|
|
return { open, currentPage, pageParams, setPage };
|
|
};
|