Refactor fetch and post to use axios

Fix set_label id missing in payload use frontend_message_id

pre-commit

Refactor api fetcher/poster to axios create

lint

Remove string literal for path

Revert oasst_api_client.ts

Fix warning httpStatusCode OasstError optional parameter

Refactor remove api base url for local api

Lint add blank line
This commit is contained in:
rjmacarthy
2023-01-13 17:05:10 +00:00
parent fd8bd49638
commit 2a8d38f058
18 changed files with 56 additions and 56 deletions
@@ -12,7 +12,6 @@ interface MessageTableEntryProps {
export function MessageTableEntry(props: MessageTableEntryProps) {
const { item } = props;
const backgroundColor = useColorModeValue("gray.50", "gray.800");
return (
<div>
<FlaggableElement message={item} key={`flag_${item.id || item.frontend_message_id}`}>
@@ -2,7 +2,7 @@ import { Box, CircularProgress, Stack, StackProps, Text, TextProps, useColorMode
import { boolean } from "boolean";
import { useState } from "react";
import { MessageTableEntry } from "src/components/Messages/MessageTableEntry";
import fetcher from "src/lib/fetcher";
import { get } from "src/lib/api";
import useSWR from "swr";
const MessageHeaderProps: TextProps = {
@@ -34,7 +34,7 @@ export function MessageWithChildren(props: MessageWithChildrenProps) {
const [message, setMessage] = useState(null);
const [children, setChildren] = useState(null);
const { isLoading } = useSWR(id ? `/api/messages/${id}` : null, fetcher, {
const { isLoading } = useSWR(id ? `/api/messages/${id}` : null, get, {
onSuccess: (data) => {
setMessage(data);
},
@@ -42,7 +42,7 @@ export function MessageWithChildren(props: MessageWithChildrenProps) {
setMessage(null);
},
});
const { isLoading: isLoadingChildren } = useSWR(id ? `/api/messages/${id}/children` : null, fetcher, {
const { isLoading: isLoadingChildren } = useSWR(id ? `/api/messages/${id}/children` : null, get, {
onSuccess: (data) => {
setChildren(data);
},