Skip to content

Commit 9c34f21

Browse files
committed
edit
1 parent 837d49c commit 9c34f21

File tree

23 files changed

+328
-42
lines changed

23 files changed

+328
-42
lines changed

backend/routes/api/users.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ router.get("/test", (req, res, next) => {
2727

2828
router.get("/coilLogin", CoilUsersController.loginPost)
2929

30-
router.get("/coilLoginToken", CoilUsersController.loginTokenPost)
30+
router.post("/coilLoginToken", CoilUsersController.loginTokenPost)
3131

3232

3333
// @route POST api/users/register

backend/task-manager/src/controller/coilUser.js

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ exports.loginTokenPost = async (req, res, next) => {
7171
}
7272
});
7373

74+
console.log(tokenRequest);
75+
76+
7477
res.send(tokenRequest)
7578
} catch (err) {
7679
console.log(err)

backend/task-manager/src/controller/user.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ exports.loginPost = async (req, res, next) => {
308308
},
309309
JWT_SECRET,
310310
{
311-
expiresIn: "1h"
311+
expiresIn: "24h"
312312
}
313313
)
314314
//res.send(user[0].name)
@@ -325,6 +325,15 @@ exports.loginPost = async (req, res, next) => {
325325
})
326326
}
327327

328+
exports.getUserInfo = async (req, res, next) => {
329+
// validate JWT expiration and signature
330+
// get userId from JWT token
331+
// const user = await User.find(_id:userId)
332+
// return res.json(user)
333+
334+
// this should be a POST request
335+
}
336+
328337
exports.logoutPost = async (req, res, next) => {
329338

330339
}

frontend/config/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ const config = {
66
// a url to a running Insight explorer endpoint
77
explorerUrl: 'https://livenet.flocha.in/api',
88
// ipfs gateway url
9-
// ipfsGatewayUrl: 'https://ipfs.io/ipfs',
10-
ipfsGatewayUrl: 'http://localhost:8080/ipfs',
9+
//ipfsGatewayUrl: 'https://ipfs-dev.alexandria.io/ipfs',
10+
ipfsGatewayUrl: 'https://ipfs.io/ipfs',
11+
//ipfsGatewayUrl: 'http://localhost:8080/ipfs',
1112
// testnet will not offer full functionality. but if you're using this you can probably figure out how to add what you want
1213
network: 'mainnet',
1314
// an array of string template names (tmpl_XXXXXXXX) to filter

frontend/package-lock.json

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"react-dom": "^16.13.1",
4444
"react-icons": "^3.10.0",
4545
"react-jss": "^10.2.0",
46-
"react-markdown": "^6.0.1",
46+
"react-markdown": "^6.0.2",
4747
"react-pdf": "^4.1.0",
4848
"react-redux": "^7.2.0",
4949
"react-spinners": "^0.8.3",

frontend/pages/_document.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ export default class JssDocument extends Document {
1717
`}
1818
</style>
1919

20-
<title>DDX</title>
21-
22-
<meta name="monetization" id="paymentPointerHead" content=""></meta>
20+
<meta name="monetization" id="paymentPointerHead" content="$ilp.uphold.com/mrq3JQe4KHMK"></meta>
2321
</Head>
22+
<title>DDX</title>
2423
<body>
2524
<Main />
2625
<NextScript />

frontend/pages/index.js

+44-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect } from 'react'
22
import PropTypes from 'prop-types'
33
import { connect } from 'react-redux'
4-
4+
import { useRouter } from 'next/router'
55
import config from '../config'
66
import InterfaceContainer from '../src/components/views/Interface/InterfaceContainer'
77

@@ -29,6 +29,49 @@ const Index = ({
2929
setPlatformData,
3030
registerPlatform
3131
}) => {
32+
33+
// work on this
34+
function getCookie(cname) {
35+
var name = cname + "=";
36+
var decodedCookie = decodeURIComponent(document.cookie);
37+
var ca = decodedCookie.split(';');
38+
for(var i = 0; i <ca.length; i++) {
39+
var c = ca[i];
40+
while (c.charAt(0) == ' ') {
41+
c = c.substring(1);
42+
}
43+
if (c.indexOf(name) == 0) {
44+
return c.substring(name.length, c.length);
45+
}
46+
}
47+
return "";
48+
}
49+
50+
const router = useRouter()
51+
console.log(router.query);
52+
53+
if (router.query.code && router.query.state && router.query.scope) {
54+
let coilTokenRequest = ''
55+
56+
fetch(`${config.backendApiUrl}/api/users/coilLoginToken`, {
57+
method: 'POST',
58+
headers: {
59+
'Content-Type': 'application/json'
60+
},
61+
body: JSON.stringify(router.query)
62+
}).then(rsp => {
63+
coilTokenRequest = rsp
64+
})
65+
66+
console.log(coilTokenRequest)
67+
}
68+
69+
useEffect(() => {
70+
if(document.cookie) {
71+
// Edit here 1203i102930129301923091230912039120931029301293
72+
}
73+
})
74+
3275
const { registered, platformData } = useRegisterPlatform({
3376
txid: config.platformRegistrationTxid,
3477
daemon: daemonApi

frontend/pages/record.js

+46-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import React, { useState, useEffect } from 'react'
22
import withStyles from 'react-jss'
33
import PropTypes from 'prop-types'
44
import { connect } from 'react-redux'
5+
import ReactLoader from '../src/components/library/ReactLoader' //import ReactLoader from '../../../library/ReactLoader'
6+
import { MdSearch } from 'react-icons/md'
7+
58
import SideBar from '../src/components/library/SideBar/SideBar'
69
import {
710
getBalance,
@@ -41,8 +44,26 @@ const Record = ({
4144
getBalance,
4245
autoPay,
4346
purchaseRecord,
44-
proofOfPurchase
47+
proofOfPurchase,
48+
searchInput,
49+
handleSearchInput,
50+
recordsFetching,
51+
templatesFetching,
52+
theme
4553
}) => {
54+
55+
const fetching = recordsFetching || templatesFetching
56+
57+
function handleOnEnter (e) {
58+
if (e.keyCode === 13 && !fetching) {
59+
handleSubmit()
60+
}
61+
}
62+
63+
function handleSubmit () {
64+
handleSearchSubmit()
65+
}
66+
4667
useEffect(() => {
4768
setActivePage(null)
4869
}, [])
@@ -177,6 +198,29 @@ useEffect(() => {
177198
return (
178199
<div className={classes.root}>
179200
<SideBar reroute/>
201+
<div className={classes.searchContainer}>
202+
<div className={classes.inputContainer}>
203+
<input
204+
className={classes.textInput}
205+
value={searchInput}
206+
onChange={handleSearchInput}
207+
type='text'
208+
placeholder={'Search'}
209+
onKeyUp={handleOnEnter}
210+
/>
211+
</div>
212+
<button
213+
onClick={handleSubmit}
214+
className={classes.submitInput}
215+
disabled={fetching}
216+
>
217+
{fetching ? <ReactLoader
218+
size={14}
219+
color={theme.palette.primary.main}
220+
/> : <MdSearch /> }
221+
222+
</button>
223+
</div>
180224
<RecordView
181225
recordPayload={recordPayload}
182226
purchasedData={purchasedData}
@@ -252,4 +296,4 @@ const mapDispatchToProps = {
252296
export default connect(
253297
mapStateToProps,
254298
mapDispatchToProps
255-
)(withStyles(styles)(Record))
299+
)(withStyles(styles, { injectTheme: true})(Record))

frontend/src/components/library/ArticleViewer/ArticleViewer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const ArticleViewer = ({
8989
subtitle={
9090
<>
9191
{writerQuery.isLoading && 'Loading byline writer...'}
92-
{writerQuery.isError && <span style={{ color: 'red' }}>'Error fetching byline writer...'}</span>}
92+
{writerQuery.isError && <span style={{ color: 'red' }}>'Error fetching byline writer...'</span>}
9393
{writerQuery.isSettled && !writerQuery.isError && <span>
9494
{firstName} {byLineWriter}, {articleTemplateData.bylineWritersTitle}, {articleTemplateData.bylineWritersLocation} / Published {datePublished.toUTCString()}
9595
</span>}

frontend/src/components/library/LoginForm/LoginForm.js

+8
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,17 @@ const LoginForm = ({
6868
const data = await response.json()
6969

7070
console.log('this is the data: ', data)
71+
72+
document.cookie = "token="+data.token+";max-age=31536000"
73+
console.log(data.token)
7174
console.log(data.displayName)
75+
76+
var storedCookie = document.cookie
77+
console.log("cookie: ", storedCookie)
7278
console.log('setUser: ', setUser(data.user))
7379

80+
data.user.token = data.token
81+
7482
dispatch(setUser(data.user))
7583

7684
// decrypt mnemonic

frontend/src/components/library/RecordRow/RecordRowData/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22
import ActionBar from '../Actionbar'
33
import TableData from '../TableData'
4+
//import ArticleMediaView from '../../ArticleViewer'
45

56
const RecordRowData = ({
67
classes,
@@ -47,8 +48,16 @@ const RecordRowData = ({
4748
verified={verified}
4849
purchasedData={purchasedData}
4950
/>
51+
5052
</div>
5153
)
5254
}
5355

5456
export default RecordRowData
57+
58+
59+
/*
60+
<ArticleMediaView
61+
body={thumbnail}
62+
/>
63+
*/

frontend/src/components/library/RecordRow/TableData/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22
import TemplateData from '../TemplateData'
33
import Thumbnail from '../Thumbnail'
4+
import ArticleMediaView from '../../ArticleViewer/Article/ArticleMediaView/ArticleMediaView'
45

56
const TableData = ({
67
classes,
@@ -13,6 +14,7 @@ const TableData = ({
1314
verified,
1415
purchasedData
1516
}) => {
17+
//console.log("Order Details: ", orderedDetails)
1618
return (
1719
<div className={classes.tableData}>
1820
{/* thumbnail here */}
@@ -39,6 +41,7 @@ const TableData = ({
3941
<span>{signed_by}</span>
4042
</>
4143
)}
44+
4245
{verified.name && (
4346
<div style={{ marginTop: '7px' }}>
4447
<span className={classes.templateName}>verified name:</span>

0 commit comments

Comments
 (0)