fix api sub categories

This commit is contained in:
grimhilt 2023-08-14 01:17:15 +02:00
parent cde6bb6b02
commit 381da95d91
5 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@ const ModalAddFile = ({ opened, handler, addFiles }) => {
setIsLoading(true); setIsLoading(true);
const formData = new FormData(); const formData = new FormData();
files.forEach((file) => formData.append('file', file)); files.forEach((file) => formData.append('file', file));
API.upload(formData) API.files.upload(formData)
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
validate(res.data); validate(res.data);

View File

@ -40,7 +40,7 @@ const ModalFileSelector = ({ opened, handleClose, handleSubmit, ...props }) => {
} }
useEffect(() => { useEffect(() => {
API.getFiles() API.files.list()
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
setFiles(res.data); setFiles(res.data);
@ -56,7 +56,7 @@ const ModalFileSelector = ({ opened, handleClose, handleSubmit, ...props }) => {
useEffect(() => { useEffect(() => {
if (search.length >= 2) { if (search.length >= 2) {
API.searchfiles(search) API.files.search(search)
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
setFiles(res.data); setFiles(res.data);
@ -66,7 +66,7 @@ const ModalFileSelector = ({ opened, handleClose, handleSubmit, ...props }) => {
setNotification(true, err); setNotification(true, err);
}); });
} else if (search.length === 0) { } else if (search.length === 0) {
API.getFiles() API.files.list()
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
setFiles(res.data); setFiles(res.data);

View File

@ -15,7 +15,7 @@ const Files = () => {
}; };
useEffect(() => { useEffect(() => {
API.getFiles() API.files.list()
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
setFiles(res.data); setFiles(res.data);

View File

@ -58,7 +58,7 @@ const Playlist = (item) => {
if (JSON.stringify(item) !== '{}') { if (JSON.stringify(item) !== '{}') {
setPlaylist(item); setPlaylist(item);
} else { } else {
API.getPlaylist(id) API.playlists.get(id)
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
setPlaylist(res.data); setPlaylist(res.data);
@ -117,7 +117,7 @@ const Playlist = (item) => {
</Group> </Group>
</Group> </Group>
<Paper p="xs" radius="sm" shadow="sm" withBorder my="md"> <Paper p="xs" radius="sm" shadow="sm" withBorder my="md">
<Content form={form} playlistId={id} /> <Content form={form} playlistId={id} playlist={playlist} />
</Paper> </Paper>
<ModalUpdate <ModalUpdate
opened={showUpdate} opened={showUpdate}

View File

@ -10,10 +10,10 @@ const ModalUserEditor = ({ opened, handlerClose, handler, APICall, name, item })
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const { user } = useAuth(); const { user } = useAuth();
const handleFinish = (e) => { const handleFinish = (e) => {
console.log(e)
if (e) { if (e) {
handler(e); handler(e);
} }
form.reset()
handlerClose(); handlerClose();
}; };