Skip to content

Commit b50632d

Browse files
authored
Feature/download of published thesis only works when logged in (#751)
1 parent 9409555 commit b50632d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

client/src/components/AuthenticatedFilePreview/AuthenticatedFilePreview.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,19 @@ interface IAuthenticatedFilePreviewProps extends BoxProps {
1616
actionButton?: ReactNode
1717
aspectRatio?: number
1818
allowDownload?: boolean
19+
requiresAuth?: boolean
1920
}
2021

2122
const AuthenticatedFilePreview = (props: IAuthenticatedFilePreviewProps) => {
22-
const { url, filename, type, actionButton, aspectRatio = 16 / 9, allowDownload = true } = props
23+
const {
24+
url,
25+
filename,
26+
type,
27+
actionButton,
28+
aspectRatio = 16 / 9,
29+
allowDownload = true,
30+
requiresAuth = true,
31+
} = props
2332

2433
const [file, setFile] = useState<File>()
2534

@@ -31,7 +40,7 @@ const AuthenticatedFilePreview = (props: IAuthenticatedFilePreviewProps) => {
3140
url,
3241
{
3342
method: 'GET',
34-
requiresAuth: true,
43+
requiresAuth: requiresAuth,
3544
responseType: 'blob',
3645
},
3746
(response) => {

client/src/pages/LandingPage/components/PublishedTheses/PublishedTheses.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ const PublishedTheses = ({ search, representationType, filters, limit }: Publish
189189
url={`/v2/published-theses/${openedThesis.thesisId}/thesis`}
190190
filename={`${openedThesis.title.toLowerCase().replaceAll(' ', '-')}.pdf`}
191191
type='pdf'
192+
requiresAuth={false}
192193
/>
193194
</Stack>
194195
)}

0 commit comments

Comments
 (0)