From d7ed03ca4fa2b7072afe24764ce175240319a07a Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Tue, 17 Nov 2020 17:01:29 +0100 Subject: [PATCH] Fix bug where setting share password would print error This solves #133 --- ui/src/Pages/SharePage/SharePage.js | 3 ++- ui/src/components/sidebar/Sharing.js | 1 + ui/src/components/sidebar/SidebarDownload.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/src/Pages/SharePage/SharePage.js b/ui/src/Pages/SharePage/SharePage.js index 0fcf4044..b8c49ef4 100644 --- a/ui/src/Pages/SharePage/SharePage.js +++ b/ui/src/Pages/SharePage/SharePage.js @@ -176,6 +176,7 @@ const TokenRoute = ({ match }) => { const { loading, error, data, refetch } = useQuery( VALIDATE_TOKEN_PASSWORD_QUERY, { + notifyOnNetworkStatusChange: true, variables: { token: match.params.token, password: getSharePassword(match.params.token), @@ -202,7 +203,7 @@ const TokenRoute = ({ match }) => { match={match} refetchWithPassword={password => { saveSharePassword(token, password) - refetch({ variables: { password } }) + refetch({ token, password }) }} loading={loading} /> diff --git a/ui/src/components/sidebar/Sharing.js b/ui/src/components/sidebar/Sharing.js index b979d368..fda7cc75 100644 --- a/ui/src/components/sidebar/Sharing.js +++ b/ui/src/components/sidebar/Sharing.js @@ -115,6 +115,7 @@ const ShareItemMoreDropdown = ({ id, share, isPhoto }) => { event.preventDefault() setPassword({ variables: { + token: share.token, password: event.target.value, }, }) diff --git a/ui/src/components/sidebar/SidebarDownload.js b/ui/src/components/sidebar/SidebarDownload.js index 3f0dfc8d..d488dfe8 100644 --- a/ui/src/components/sidebar/SidebarDownload.js +++ b/ui/src/components/sidebar/SidebarDownload.js @@ -179,7 +179,7 @@ const SidebarDownload = ({ photo }) => { let downloadRows = downloads.map(x => ( downloadMedia(x.mediaUrl.url, photo.title)} + onClick={() => downloadMedia(x.mediaUrl.url)} > {`${x.title}`} {`${x.mediaUrl.width} x ${x.mediaUrl.height}`}