fix(admin,server): 上传改用 file.buffer 并移除手写 multipart 头
This commit is contained in:
@@ -140,9 +140,7 @@ const ClassroomRentalsPage: React.FC = () => {
|
||||
);
|
||||
const uploadContractMutation = useApiMutation(
|
||||
async ({ id, formData }: { id: number; formData: FormData }) =>
|
||||
api.post(`/classroom-rentals/${id}/contract`, formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post(`/classroom-rentals/${id}/contract`, formData),
|
||||
{ invalidate: [['classroom-rentals']] },
|
||||
);
|
||||
|
||||
|
||||
@@ -110,9 +110,7 @@ const ClassroomsPage: React.FC = () => {
|
||||
);
|
||||
const importMutation = useApiMutation(
|
||||
async (formData: FormData) =>
|
||||
api.post('/classrooms/import', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post('/classrooms/import', formData),
|
||||
{ invalidate: [['classrooms']] },
|
||||
);
|
||||
|
||||
|
||||
@@ -137,16 +137,12 @@ const ExpensesPage: React.FC = () => {
|
||||
),
|
||||
importUtility: useApiMutation(
|
||||
async (formData: FormData) =>
|
||||
api.post('/expenses/utility/import', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post('/expenses/utility/import', formData),
|
||||
{ invalidate: [['expenses']] },
|
||||
),
|
||||
importPersonal: useApiMutation(
|
||||
async (formData: FormData) =>
|
||||
api.post('/expenses/personal/import', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post('/expenses/personal/import', formData),
|
||||
{ invalidate: [['expenses']] },
|
||||
),
|
||||
archiveRoom: useApiMutation(
|
||||
|
||||
@@ -44,9 +44,7 @@ export function useOccupancyMutations() {
|
||||
);
|
||||
const importMutation = useApiMutation(
|
||||
async ({ formData, params }: { formData: FormData; params: string }) =>
|
||||
api.post(`/occupancies/import?${params}`, formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post(`/occupancies/import?${params}`, formData),
|
||||
{ invalidate: invalidateOccupancies },
|
||||
);
|
||||
|
||||
|
||||
@@ -143,9 +143,7 @@ export function useRoomMutations(editing: any) {
|
||||
);
|
||||
const importMutation = useApiMutation(
|
||||
async (formData: FormData) =>
|
||||
api.post<{ message?: string }>('/rooms/import', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post<{ message?: string }>('/rooms/import', formData),
|
||||
{ invalidate: [['rooms']] },
|
||||
);
|
||||
|
||||
|
||||
@@ -228,16 +228,12 @@ const StudentsPage: React.FC = () => {
|
||||
);
|
||||
const importMutation = useApiMutation(
|
||||
async (formData: FormData) =>
|
||||
api.post('/students/import', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post('/students/import', formData),
|
||||
{ invalidate: invalidateStudents },
|
||||
);
|
||||
const importMatchMutation = useApiMutation(
|
||||
async (formData: FormData) =>
|
||||
api.post('/students/import-match', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
}),
|
||||
api.post('/students/import-match', formData),
|
||||
{ invalidate: invalidateStudents },
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user