mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-05 01:09:30 +00:00
split between userConfig and userAccount
This commit is contained in:
@@ -1,17 +1,6 @@
|
||||
import { SortByType, SortOrderType, ViewLayoutType } from '../../pages/Home';
|
||||
import APIClient from '../../functions/APIClient';
|
||||
|
||||
export type UserMeType = {
|
||||
id: number;
|
||||
name: string;
|
||||
is_superuser: boolean;
|
||||
is_staff: boolean;
|
||||
groups: [];
|
||||
user_permissions: [];
|
||||
last_login: string;
|
||||
config: UserConfigType;
|
||||
};
|
||||
|
||||
export type ColourVariants = 'dark.css' | 'light.css' | 'matrix.css' | 'midnight.css';
|
||||
|
||||
export type UserConfigType = {
|
||||
@@ -33,7 +22,7 @@ export type UserConfigType = {
|
||||
const updateUserConfig = async (config: Partial<UserConfigType>): Promise<UserConfigType> => {
|
||||
return APIClient('/api/user/me/', {
|
||||
method: 'POST',
|
||||
body: { config: config },
|
||||
body: config,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
8
frontend/src/api/loader/loadUserAccount.ts
Normal file
8
frontend/src/api/loader/loadUserAccount.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import APIClient from '../../functions/APIClient';
|
||||
import { UserAccountType } from '../../pages/Base';
|
||||
|
||||
const loadUserAccount = async (): Promise<UserAccountType> => {
|
||||
return APIClient('/api/user/account/');
|
||||
};
|
||||
|
||||
export default loadUserAccount;
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UserMeType } from '../actions/updateUserConfig';
|
||||
import { UserConfigType } from '../actions/updateUserConfig';
|
||||
import APIClient from '../../functions/APIClient';
|
||||
|
||||
const loadUserMeConfig = async (): Promise<UserMeType> => {
|
||||
const loadUserMeConfig = async (): Promise<UserConfigType> => {
|
||||
return APIClient('/api/user/me/');
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user