mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-08 20:09:28 +00:00
Feat global state (#861)
* add zustand, add auth store * add user config store, isAdmin from store * move ColourVariants, fix importColours * get userConfig from store * fix name conflict * home filter bar from config store * use user store for channel list * use userConfig store for channel pages * use userConfig for playlist pages * fix channel video type navigation * use userConfig update on downloads page * fix view style in search * handle initial user config, take 2 * modify userSettings in global state
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { ColourVariants } from '../../configuration/colours/getColours';
|
||||
import { SortByType, SortOrderType, ViewLayoutType } from '../../pages/Home';
|
||||
import getApiUrl from '../../configuration/getApiUrl';
|
||||
import defaultHeaders from '../../configuration/defaultHeaders';
|
||||
@@ -16,23 +15,24 @@ export type UserMeType = {
|
||||
config: UserConfigType;
|
||||
};
|
||||
|
||||
export type ColourVariants = 'dark.css' | 'light.css' | 'matrix.css' | 'midnight.css';
|
||||
|
||||
export type UserConfigType = {
|
||||
stylesheet?: ColourVariants;
|
||||
page_size?: number;
|
||||
sort_by?: SortByType;
|
||||
sort_order?: SortOrderType;
|
||||
view_style_home?: ViewLayoutType;
|
||||
view_style_channel?: ViewLayoutType;
|
||||
view_style_downloads?: ViewLayoutType;
|
||||
view_style_playlist?: ViewLayoutType;
|
||||
grid_items?: number;
|
||||
hide_watched?: boolean;
|
||||
show_ignored_only?: boolean;
|
||||
show_subed_only?: boolean;
|
||||
sponsorblock_id?: number;
|
||||
stylesheet: ColourVariants;
|
||||
page_size: number;
|
||||
sort_by: SortByType;
|
||||
sort_order: SortOrderType;
|
||||
view_style_home: ViewLayoutType;
|
||||
view_style_channel: ViewLayoutType;
|
||||
view_style_downloads: ViewLayoutType;
|
||||
view_style_playlist: ViewLayoutType;
|
||||
grid_items: number;
|
||||
hide_watched: boolean;
|
||||
show_ignored_only: boolean;
|
||||
show_subed_only: boolean;
|
||||
};
|
||||
|
||||
const updateUserConfig = async (config: UserConfigType): Promise<UserConfigType> => {
|
||||
const updateUserConfig = async (config: Partial<UserConfigType>): Promise<UserConfigType> => {
|
||||
const apiUrl = getApiUrl();
|
||||
const csrfCookie = getCookie('csrftoken');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user