Skip to content

Commit

Permalink
lint & tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
matborowczyk committed Jan 30, 2025
1 parent 4ef50de commit 7c884a3
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 130 deletions.
6 changes: 3 additions & 3 deletions src/Data/Managers/V2/Auth/AddUser/useAddUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ interface AddUserBody {
*/
export const useAddUser = () => {
const client = useQueryClient();
const post = usePost()<AddUSerResponse, AddUserBody>;
const post = usePost()<AddUserBody>;

return useMutation({
mutationFn: (body: AddUserBody) => post(`/api/v2/user`, body),
return useMutation<AddUSerResponse, Error, AddUserBody>({
mutationFn: (body) => post(`/api/v2/user`, body),
mutationKey: ["add_user"],
onSuccess: () => {
//refetch the users query to update the list
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Managers/V2/Auth/Login/useLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ interface LoginBody {
* @returns A tuple containing the mutation function and mutation state.
*/
export const useLogin = () => {
const post = usePostWithoutEnv()<LoginResponse, LoginBody>;
const post = usePostWithoutEnv()<LoginBody>;

return useMutation({
mutationFn: (body: LoginBody) => post("/api/v2/login", body),
return useMutation<LoginResponse, Error, LoginBody>({
mutationFn: (body) => post("/api/v2/login", body),
mutationKey: ["login"],
});
};
2 changes: 1 addition & 1 deletion src/Data/Managers/V2/Auth/RemoveUser/useRemoveUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useRemoveUser = (): UseMutationResult<
unknown
> => {
const client = useQueryClient();
const deleteFn = useDelete()<void>;
const deleteFn = useDelete();

return useMutation({
mutationFn: (username) => deleteFn(`/api/v2/user/${username}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useDeleteDesiredStateVersion = (): UseMutationResult<
unknown
> => {
const client = useQueryClient();
const deleteFn = useDelete()<void>;
const deleteFn = useDelete();

return useMutation({
mutationFn: (version) => deleteFn(`/api/v1/version/${version}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const usePromoteDesiredStateVersion = (): UseMutationResult<
unknown
> => {
const client = useQueryClient();
const post = usePost()<void, void>;
const post = usePost()<void>;

return useMutation({
mutationFn: (version) => post(`/api/v2/desiredstate/${version}/promote`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useUpdateEnvConfig = (): UseMutationResult<
> => {
const client = useQueryClient();

const post = usePost()<void, string | boolean | ParsedNumber | Dict>;
const post = usePost()<string | boolean | ParsedNumber | Dict>;

return useMutation({
mutationFn: ({ id, value }) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const useDeleteService = (
service_entity: string,
): UseMutationResult<void, Error, void, unknown> => {
const client = useQueryClient();
const deleteFn = useDelete()<void>;
const deleteFn = useDelete();

return useMutation({
mutationFn: () => deleteFn(`/lsm/v1/service_catalog/${service_entity}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useExportCatalog = (): UseMutationResult<
unknown
> => {
const client = useQueryClient();
const post = usePost()<void, void>;
const post = usePost()<void>;

return useMutation({
mutationFn: () => post(`/lsm/v1/exporter/export_service_definition`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const useDeleteInstance = (
service_entity: string,
version: ParsedNumber,
): UseMutationResult<void, Error, void, unknown> => {
const deleteFn = useDelete()<void>;
const deleteFn = useDelete();

return useMutation({
mutationFn: () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const useDestroyInstance = (
version: ParsedNumber,
message: string,
): UseMutationResult<void, Error, void, unknown> => {
const deleteFn = useDelete({ message })<void>;
const deleteFn = useDelete({ message });

return useMutation({
mutationFn: () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const usePatchAttributesExpert = (
instance_id: string,
service_entity: string,
): UseMutationResult<void, Error, ExpertPatchAttributes, unknown> => {
const patch = usePatch()<void, ExpertPatchAttributes>;
const patch = usePatch()<ExpertPatchAttributes>;

return useMutation({
mutationFn: (data) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export const usePostExpertStateTransfer = (
instance_id: string,
service_entity: string,
): UseMutationResult<void, Error, PostExpertStateTransfer, unknown> => {
const deleteRequest = usePost()<void, PostExpertStateTransfer>;
const post = usePost()<PostExpertStateTransfer>;

return useMutation({
mutationFn: (data) =>
deleteRequest(
post(
`/lsm/v1/service_inventory/${service_entity}/${instance_id}/expert/state`,
data,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const usePostMetadata = (): UseMutationResult<
PostMetadataInfo,
unknown
> => {
const post = usePost()<void, PostMetadataInfo>;
const post = usePost()<PostMetadataInfo>;

return useMutation({
mutationFn: (info) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ interface PostOrderBody {
*/
export const usePostOrder = (
options?: UseMutationOptions<PostResponse, Error, ComposerServiceOrderItem[]>,
): UseMutationResult<
PostResponse,
Error,
ComposerServiceOrderItem[],
unknown
> => {
const post = usePost()<PostResponse, PostOrderBody>;
): UseMutationResult<PostResponse, Error, ComposerServiceOrderItem[]> => {
const post = usePost()<PostOrderBody>;

return useMutation({
mutationFn: (service_order_items) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const usePostStateTransfer = (
service_entity: string,
options?: UseMutationOptions<StateTransferResponse, Error, PostStateTransfer>,
): UseMutationResult<StateTransferResponse, Error, PostStateTransfer> => {
const post = usePost()<StateTransferResponse, PostStateTransfer>;
const post = usePost()<PostStateTransfer>;

return useMutation({
mutationFn: (body) =>
Expand Down
Loading

0 comments on commit 7c884a3

Please sign in to comment.