bug fix - wrong function angrument
This commit is contained in:
parent
d6c0bd189b
commit
bdad456637
@ -100,8 +100,9 @@ def create_student(data: dict) -> dict:
|
||||
@bp.route("/upload/", methods=["POST"])
|
||||
@bp.input(FileSchema, location='form_and_files')
|
||||
@bp.output(MessageSchema)
|
||||
def upload_students(file: dict, mode: bool) -> dict:
|
||||
def upload_students(file: dict) -> dict:
|
||||
uploaded_file = file.get('file')
|
||||
mode = file.get('mode') == '0'
|
||||
|
||||
if uploaded_file and is_allowed_extensions(uploaded_file.filename):
|
||||
try:
|
||||
|
@ -34,9 +34,8 @@ export const getStudents = (
|
||||
export const createStudent = (payload: Student) =>
|
||||
axiosInstance.post('http://127.0.0.1:5000/api/coordinator/students/', payload)
|
||||
|
||||
export const uploadStudents = (payload: FormData, mode: Boolean) =>
|
||||
export const uploadStudents = (payload: FormData) =>
|
||||
axiosInstance.post(
|
||||
'http://127.0.0.1:5000/api/coordinator/students/upload/',
|
||||
payload,
|
||||
mode,
|
||||
)
|
||||
|
@ -40,7 +40,7 @@ const Students = () => {
|
||||
|
||||
const { mutate: mutateUpload } = useMutation(
|
||||
'uploadStudents',
|
||||
(payload: FormData) => uploadStudents(payload, mode),
|
||||
(payload: FormData) => uploadStudents(payload),
|
||||
{
|
||||
onSuccess: () => refetchStudents(),
|
||||
},
|
||||
@ -50,6 +50,7 @@ const Students = () => {
|
||||
const file = event.target.files[0]
|
||||
const payload = new FormData()
|
||||
payload.append('file', file, file.name)
|
||||
payload.append('mode', mode ? '0' : '1')
|
||||
mutateUpload(payload)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user