Replace axios with fetch

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-05-11 23:37:37 +02:00
parent 2f57d0a5bd
commit f3165877f2
144 changed files with 1146 additions and 2754 deletions

View File

@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl';
import { Banner, Button, HStack, Stack, Text } from 'soapbox/components/ui';
import { useInstance, useSoapboxConfig } from 'soapbox/hooks';
const acceptedGdpr = !!localStorage.getItem('soapbox:gdpr');
const acceptedGdpr = !!localStorage.getItem('plfe:gdpr');
/** Displays a cookie consent banner. */
const GdprBanner: React.FC = () => {
@ -17,7 +17,7 @@ const GdprBanner: React.FC = () => {
const { gdprUrl } = useSoapboxConfig();
const handleAccept = () => {
localStorage.setItem('soapbox:gdpr', 'true');
localStorage.setItem('plfe:gdpr', 'true');
setSlideout(true);
setTimeout(() => setShown(true), 200);
};

View File

@ -112,7 +112,7 @@ const ScrollableList = React.forwardRef<VirtuosoHandle, IScrollableList>(({
const { autoloadMore } = useSettings();
// Preserve scroll position
const scrollDataKey = `soapbox:scrollData:${scrollKey}`;
const scrollDataKey = `plfe:scrollData:${scrollKey}`;
const scrollData: SavedScrollPosition | null = useMemo(() => JSON.parse(sessionStorage.getItem(scrollDataKey)!), [scrollDataKey]);
const topIndex = useRef<number>(scrollData ? scrollData.index : 0);
const topOffset = useRef<number>(scrollData ? scrollData.offset : 0);

View File

@ -3,7 +3,6 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useHistory, useRouteMatch } from 'react-router-dom';
import { blockAccount } from 'soapbox/actions/accounts';
import { launchChat } from 'soapbox/actions/chats';
import { directCompose, mentionCompose, quoteCompose, replyCompose } from 'soapbox/actions/compose';
import { editEvent } from 'soapbox/actions/events';
import { toggleBookmark, toggleDislike, toggleFavourite, togglePin, toggleReblog } from 'soapbox/actions/interactions';
@ -20,6 +19,7 @@ import StatusActionButton from 'soapbox/components/status-action-button';
import StatusReactionWrapper from 'soapbox/components/status-reaction-wrapper';
import { HStack } from 'soapbox/components/ui';
import { useAppDispatch, useAppSelector, useFeatures, useOwnAccount, useSettings, useSoapboxConfig } from 'soapbox/hooks';
import { useChats } from 'soapbox/queries/chats';
import { GroupRoles } from 'soapbox/schemas/group-member';
import toast from 'soapbox/toast';
import copy from 'soapbox/utils/copy';
@ -124,6 +124,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
const { group } = useGroup((status.group as Group)?.id as string);
const deleteGroupStatus = useDeleteGroupStatus(group as Group, status.id);
const blockGroupMember = useBlockGroupMember(group as Group, status.account);
const { getOrCreateChatByAccountId } = useChats();
const me = useAppSelector(state => state.me);
const { groupRelationship } = useGroupRelationship(status.group?.id);
@ -255,7 +256,10 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
const handleChatClick: React.EventHandler<React.MouseEvent> = (e) => {
const account = status.account;
dispatch(launchChat(account.id, history));
getOrCreateChatByAccountId(account.id)
.then(({ json: chat }) => history.push(`/chats/${chat.id}`))
.catch(() => {});
};
const handleMuteClick: React.EventHandler<React.MouseEvent> = (e) => {