pl-api: remove unused code

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-06 15:44:16 +01:00
parent 78c924776e
commit 38d0a43498
2 changed files with 2 additions and 45 deletions

View File

@ -1,11 +1,7 @@
import { getClient } from '@/api';
import type { AppDispatch, RootState } from '@/store';
import type { CreateAccountParams, Relationship } from 'pl-api';
const ACCOUNT_BLOCK_SUCCESS = 'ACCOUNT_BLOCK_SUCCESS' as const;
const ACCOUNT_MUTE_SUCCESS = 'ACCOUNT_MUTE_SUCCESS' as const;
const ACCOUNT_UNFOLLOW_SUCCESS = 'ACCOUNT_UNFOLLOW_SUCCESS' as const;
import type { CreateAccountParams } from 'pl-api';
const createAccount =
(params: CreateAccountParams) => (_dispatch: AppDispatch, getState: () => RootState) =>
@ -13,18 +9,4 @@ const createAccount =
.settings.createAccount(params)
.then((response) => ({ params, response }));
type AccountsAction = {
type:
| typeof ACCOUNT_BLOCK_SUCCESS
| typeof ACCOUNT_MUTE_SUCCESS
| typeof ACCOUNT_UNFOLLOW_SUCCESS;
relationship: Relationship;
};
export {
ACCOUNT_BLOCK_SUCCESS,
ACCOUNT_MUTE_SUCCESS,
ACCOUNT_UNFOLLOW_SUCCESS,
createAccount,
type AccountsAction,
};
export { createAccount };

View File

@ -1,14 +1,7 @@
import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
import { useMemo } from 'react';
import {
ACCOUNT_BLOCK_SUCCESS,
ACCOUNT_MUTE_SUCCESS,
ACCOUNT_UNFOLLOW_SUCCESS,
type AccountsAction,
} from '@/actions/accounts';
import { batcher } from '@/api/batcher';
import { useAppDispatch } from '@/hooks/use-app-dispatch';
import { useClient } from '@/hooks/use-client';
import { useLoggedIn } from '@/hooks/use-logged-in';
import { useOwnAccount } from '@/hooks/use-own-account';
@ -123,7 +116,6 @@ const useFollowAccountMutation = (accountId: string) => {
const useUnfollowAccountMutation = (accountId: string) => {
const client = useClient();
const dispatch = useAppDispatch();
const queryClient = useQueryClient();
return useMutation({
@ -145,11 +137,6 @@ const useUnfollowAccountMutation = (accountId: string) => {
},
onSuccess: (data) => {
queryClient.setQueryData(queryKeys.accountRelationships.show(accountId), data);
dispatch({
type: ACCOUNT_UNFOLLOW_SUCCESS,
relationship: data,
});
},
});
};
@ -157,7 +144,6 @@ const useUnfollowAccountMutation = (accountId: string) => {
const useBlockAccountMutation = (accountId: string) => {
const client = useClient();
const queryClient = useQueryClient();
const dispatch = useAppDispatch();
const { filterContexts } = useContextsActions();
return useMutation({
@ -194,11 +180,6 @@ const useBlockAccountMutation = (accountId: string) => {
// Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
filterContexts(data);
useTimelinesStore.getState().actions.filterTimelines(data.id);
return dispatch<AccountsAction>({
type: ACCOUNT_BLOCK_SUCCESS,
relationship: data,
});
},
});
};
@ -230,7 +211,6 @@ const useUnblockAccountMutation = (accountId: string) => {
const useMuteAccountMutation = (accountId: string) => {
const client = useClient();
const queryClient = useQueryClient();
const dispatch = useAppDispatch();
const { filterContexts } = useContextsActions();
return useMutation({
@ -263,11 +243,6 @@ const useMuteAccountMutation = (accountId: string) => {
// Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
filterContexts(data);
useTimelinesStore.getState().actions.filterTimelines(data.id);
return dispatch<AccountsAction>({
type: ACCOUNT_MUTE_SUCCESS,
relationship: data,
});
},
});
};