mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-29 10:59:07 +00:00
refactor: prevent upload logo errors from being stuck
This commit is contained in:
committed by
Alex Christoffer Rasmussen
parent
ac14cb9624
commit
c5ff254267
@@ -27,6 +27,7 @@ export default function ProjectData() {
|
|||||||
reset,
|
reset,
|
||||||
formState: { isSubmitting, isValid, isDirty, errors },
|
formState: { isSubmitting, isValid, isDirty, errors },
|
||||||
setError,
|
setError,
|
||||||
|
clearErrors,
|
||||||
watch,
|
watch,
|
||||||
control,
|
control,
|
||||||
setValue,
|
setValue,
|
||||||
@@ -53,6 +54,7 @@ export default function ProjectData() {
|
|||||||
|
|
||||||
const handleUploadProjectLogo = async (event: ChangeEvent<HTMLInputElement>) => {
|
const handleUploadProjectLogo = async (event: ChangeEvent<HTMLInputElement>) => {
|
||||||
const file = event.target.files?.[0];
|
const file = event.target.files?.[0];
|
||||||
|
clearErrors('logo');
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return;
|
return;
|
||||||
@@ -93,6 +95,7 @@ export default function ProjectData() {
|
|||||||
|
|
||||||
const onSubmit = async (formData: ProjectData) => {
|
const onSubmit = async (formData: ProjectData) => {
|
||||||
try {
|
try {
|
||||||
|
clearErrors();
|
||||||
await updateProjectData(formData);
|
await updateProjectData(formData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = maybeAxiosError(error);
|
const message = maybeAxiosError(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user