generated from template/astro-template
fix
This commit is contained in:
parent
e8867fc379
commit
f6979c6d33
@ -12,6 +12,7 @@ import { toast } from 'react-toastify';
|
||||
import { hashFile } from '../../modules/hash-file';
|
||||
import { uploadChunkV2 } from '../../modules/upload';
|
||||
import { downloadFile, toFile } from '../../modules/to-file';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
type ImageResource = {};
|
||||
export const ImagesResources = (props: ImageResource) => {
|
||||
@ -207,9 +208,11 @@ export const Core = ({ onClose, id }: CoreProps) => {
|
||||
for (const file of files) {
|
||||
if (file.dataURL.startsWith('data')) {
|
||||
const _file = toFile(file.dataURL, file.id);
|
||||
const day = dayjs().format('YYYY-MM');
|
||||
const directory = `excalidraw/${day}/${id}`;
|
||||
const res = (await uploadChunkV2(_file, {
|
||||
filename: file.id,
|
||||
directory: id,
|
||||
directory: directory,
|
||||
})) as any;
|
||||
if (res.code === 200) {
|
||||
toast.success('上传图片成功');
|
||||
|
Loading…
x
Reference in New Issue
Block a user