upate lodaer for normal share
This commit is contained in:
parent
cb29371959
commit
a12142f677
|
@ -22,6 +22,7 @@ import { Row, Value } from './Container';
|
||||||
import { CodeBlock } from './CodeBlock';
|
import { CodeBlock } from './CodeBlock';
|
||||||
import { ButtonVariant, getVariantColor } from './pages/gallery/LinkButton';
|
import { ButtonVariant, getVariantColor } from './pages/gallery/LinkButton';
|
||||||
import { handleSharingErrors } from 'utils/error';
|
import { handleSharingErrors } from 'utils/error';
|
||||||
|
import { sleep } from 'utils/common';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
show: boolean;
|
show: boolean;
|
||||||
|
@ -62,6 +63,7 @@ function CollectionShare(props: Props) {
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
galleryContext.startLoading();
|
||||||
const user: User = getData(LS_KEYS.USER);
|
const user: User = getData(LS_KEYS.USER);
|
||||||
if (email === user.email) {
|
if (email === user.email) {
|
||||||
setFieldError('email', constants.SHARE_WITH_SELF);
|
setFieldError('email', constants.SHARE_WITH_SELF);
|
||||||
|
@ -73,7 +75,8 @@ function CollectionShare(props: Props) {
|
||||||
setFieldError('email', constants.ALREADY_SHARED(email));
|
setFieldError('email', constants.ALREADY_SHARED(email));
|
||||||
} else {
|
} else {
|
||||||
await shareCollection(props.collection, email);
|
await shareCollection(props.collection, email);
|
||||||
await props.syncWithRemote();
|
await sleep(2000);
|
||||||
|
await galleryContext.syncWithRemote(false, true);
|
||||||
resetForm();
|
resetForm();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -81,11 +84,18 @@ function CollectionShare(props: Props) {
|
||||||
setFieldError('email', errorMessage);
|
setFieldError('email', errorMessage);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
galleryContext.finishLoading();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const collectionUnshare = async (sharee) => {
|
const collectionUnshare = async (sharee) => {
|
||||||
await unshareCollection(props.collection, sharee.email);
|
try {
|
||||||
await props.syncWithRemote();
|
galleryContext.startLoading();
|
||||||
|
await unshareCollection(props.collection, sharee.email);
|
||||||
|
await sleep(2000);
|
||||||
|
await galleryContext.syncWithRemote(false, true);
|
||||||
|
} finally {
|
||||||
|
galleryContext.finishLoading();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const createSharableURLHelper = async () => {
|
const createSharableURLHelper = async () => {
|
||||||
|
|
Loading…
Reference in a new issue