forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPdfSlideshowLoader.js
More file actions
31 lines (29 loc) · 844 Bytes
/
Copy pathPdfSlideshowLoader.js
File metadata and controls
31 lines (29 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React from "react"
import PdfSlideshow, { setPdfJsWorkerPath } from "pdf-slideshow"
import { withPrefix } from "gatsby"
import ReduxActionAnalytics from "redux-action-analytics"
import { canDoResearch } from "../../services/moocfi"
import * as storejs from "store"
setPdfJsWorkerPath(withPrefix("/pdf.worker.min.js"))
export default props => {
const middleware = []
const analytics = new ReduxActionAnalytics(
"https://usage.testmycode.io/api/v0/data",
"pdf-slideshow",
props.pdfLocation,
10000,
() => {
const user = storejs.get("tmc.user")
if (user === undefined) {
return {}
}
return {
username: user.username,
}
},
)
if (canDoResearch()) {
middleware.push(analytics.getMiddleware())
}
return <PdfSlideshow {...props} middleware={middleware} />
}