@userfrosting/sprinkle-admin
Version:
Admin Sprinkle for UserFrosting 6
57 lines (56 loc) • 2.15 kB
TypeScript
import { ApiErrorResponse } from '@userfrosting/sprinkle-core/interfaces';
import { UserCreateRequest, UserEditRequest, UserResponse } from '../interfaces';
/**
* Vue composable for User CRUD operations.
*
* Endpoints:
* - GET /api/users/u/{user_name} -> UserResponse
* - POST /api/users -> UserCreateResponse
* - PUT /api/users/u/{user_name} -> UserEditResponse
* - DELETE /api/users/u/{user_name} -> UserDeleteResponse
*
* Reactive state:
* - apiLoading: boolean
* - apiError: ApiErrorResponse | null
* - formData: UserCreateRequest
* - r$: validation state from Regle for formData
*
* Methods:
* - fetchUser(user_name: string): Promise<UserResponse>
* - createUser(data: UserCreateRequest): Promise<void>
* - updateUser(user_name: string, data: UserEditRequest): Promise<void>
* - deleteUser(user_name: string): Promise<void>
* - resetForm(): void
*/
export declare function useUserApi(): {
fetchUser: (user_name: string) => Promise<UserResponse>;
createUser: (data: UserCreateRequest) => Promise<void>;
updateUser: (user_name: string, data: UserEditRequest) => Promise<void>;
deleteUser: (user_name: string) => Promise<void>;
apiError: import('vue').Ref<ApiErrorResponse | null | undefined, ApiErrorResponse | null | undefined>;
apiLoading: import('vue').Ref<boolean, boolean>;
formData: import('vue').Ref<{
user_name: string;
group_id: number | null;
first_name: string;
last_name: string;
email: string;
locale: string;
}, UserCreateRequest | {
user_name: string;
group_id: number | null;
first_name: string;
last_name: string;
email: string;
locale: string;
}>;
r$: import('vue').Raw<import('@regle/core').RegleRoot<{
user_name: string;
group_id: number | null;
first_name: string;
last_name: string;
email: string;
locale: string;
}, Record<string, any>, Record<string, import('@regle/core').RegleValidationGroupEntry[]>, import('@regle/core').RegleShortcutDefinition<any>>>;
resetForm: () => void;
};