mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Instead of return a JSON response, redirect back to the previous screen (#9055)
This commit is contained in:
parent
0031fab0fe
commit
6e83679528
|
@ -38,7 +38,7 @@ class UserFilesController extends Controller
|
|||
$filename = 'user-' . $user->id . '-' . str_random(8);
|
||||
$filename .= '-' . str_slug($file->getClientOriginalName()) . '.' . $extension;
|
||||
if (!$file->move($destinationPath, $filename)) {
|
||||
return JsonResponse::create(["error" => "Unabled to move file"], 500);
|
||||
return redirect()->back()->with('error', trans('admin/users/message.upload.invalidfiles'));
|
||||
}
|
||||
//Log the uploaded file to the log
|
||||
$logAction = new Actionlog();
|
||||
|
@ -57,10 +57,10 @@ class UserFilesController extends Controller
|
|||
}
|
||||
$logActions[] = $logAction;
|
||||
}
|
||||
// dd($logActions);
|
||||
return JsonResponse::create($logActions);
|
||||
// dd($logActions);
|
||||
return redirect()->back()->with('success', trans('admin/users/message.upload.success'));
|
||||
}
|
||||
return JsonResponse::create(["error" => "No User associated with this request"], 500);
|
||||
return redirect()->back()->with('error', trans('admin/users/message.upload.nofiles'));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue