mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-08 23:18:15 -07:00
Pre-release version v0.0.13 (#52)
* feat: search/merge items by id * feat: update track duration using musicbrainz * chore: changelog * fix: make username updates case insensitive * feat: add minutes listened to ui and fix image drop * chore: changelog * fix: embed db migrations (#37) * feat: Add support for ARM in publish workflow (#51) * chore: changelog * docs: search by id and custom theme support --------- Co-authored-by: potatoattack <lvl70nub@gmail.com> Co-authored-by: Benjamin Jonard <benjaminjonard@users.noreply.github.com>
This commit is contained in:
parent
5537b6fb89
commit
5419178012
32 changed files with 1252 additions and 100 deletions
|
|
@ -3,11 +3,10 @@ import { useEffect } from 'react';
|
|||
|
||||
interface Props {
|
||||
itemType: string,
|
||||
id: number,
|
||||
onComplete: Function
|
||||
}
|
||||
|
||||
export default function ImageDropHandler({ itemType, id, onComplete }: Props) {
|
||||
export default function ImageDropHandler({ itemType, onComplete }: Props) {
|
||||
useEffect(() => {
|
||||
const handleDragOver = (e: DragEvent) => {
|
||||
console.log('dragover!!')
|
||||
|
|
@ -25,7 +24,11 @@ export default function ImageDropHandler({ itemType, id, onComplete }: Props) {
|
|||
|
||||
const formData = new FormData();
|
||||
formData.append('image', imageFile);
|
||||
formData.append(itemType.toLowerCase()+'_id', String(id))
|
||||
const pathname = window.location.pathname;
|
||||
const segments = pathname.split('/');
|
||||
const filteredSegments = segments.filter(segment => segment !== '');
|
||||
const lastSegment = filteredSegments[filteredSegments.length - 1];
|
||||
formData.append(itemType.toLowerCase()+'_id', lastSegment)
|
||||
replaceImage(formData).then((r) => {
|
||||
if (r.status >= 200 && r.status < 300) {
|
||||
onComplete()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue