Browse Source

wrap promise response in set timeout to keep local state in sync (#2531)

pull/2533/head
André Rusakow 3 years ago committed by GitHub
parent
commit
15533d3d8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      web/components/config/EditLogo.tsx
  2. 2
      web/utils/images.ts

3
web/components/config/EditLogo.tsx

@ -71,7 +71,7 @@ export const EditLogo: FC = () => {
getBase64(file, (url: string) => { getBase64(file, (url: string) => {
setlogoUrl(url); setlogoUrl(url);
return res(); setTimeout(() => res(), 100);
}); });
}); });
}; };
@ -80,7 +80,6 @@ export const EditLogo: FC = () => {
const handleLogoUpdate = async () => { const handleLogoUpdate = async () => {
if (logoUrl !== currentLogo) { if (logoUrl !== currentLogo) {
setSubmitStatus(createInputStatus(STATUS_PROCESSING)); setSubmitStatus(createInputStatus(STATUS_PROCESSING));
await postConfigUpdateToAPI({ await postConfigUpdateToAPI({
apiPath, apiPath,
data: { value: logoUrl }, data: { value: logoUrl },

2
web/utils/images.ts

@ -1,5 +1,3 @@
import { RcFile } from 'antd/lib/upload';
export const MAX_IMAGE_FILESIZE = 2097152; export const MAX_IMAGE_FILESIZE = 2097152;
export const ACCEPTED_IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/gif']; export const ACCEPTED_IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/gif'];

Loading…
Cancel
Save