Closed jfrcom closed 5 years ago
The latest (untested) commit adds timeElapsed
and dateStamp
to the database.
Could do a git pull
and try again?
I would still like to know how to achieve this. Could you help me?
@bluecomjona Could you try to explain your use case?
The update of #163 should make timeElapsed
and dateStamp
available the same way as data._Id (data.timeElapsed and data.dateStamp)
I can't find data.timeElapse. Where is it?
The data is submitted here in the code: https://github.com/Alheimsins/bigfive-web/blob/master/pages/test.js#L124
I think we misunderstand.. I want to have a variable which I can use after someone submitted the test like the data._id.
I think I understand what you want :-)
@maccyber added timeElapsed
and dateStamp
to the saved data. I pointed to one place in the code where these values are available as data.timeElapsed and data.dateStamp. The other option is here: https://github.com/Alheimsins/bigfive-web/blob/master/pages/showResult.js#L23
If you want to use timeElapsed and dateStamp you'll have to extract the values from the given points in the code. A quick example from here https://github.com/Alheimsins/bigfive-web/blob/master/pages/test.js#L124
If you change the code to something like this:
const { data } = await httpInstance.post('/api/save', result)
setItem('result', data._id)
Router.pushRoute('showResult', { id: data._id, timeElapsed: data.timeElapsed, dateStamp: data.dateStamp })
The url for the redirect will be http://someaddress.somedomain/result/someId?timeElapsed=someValue&dateStamp=someOtherValue
So the data is available but you'll have to change your code to make use of it.
Thank's a lot, but it doesn't work for me. alert (const { data } = await httpInstance.post('/api/save', result) setItem('result', data._id) Router.pushRoute('showResult', { id: data._id, timeElapsed: data.timeElapsed, dateStamp: data.dateStamp }) alert (data.timeElapsed)
I tried it like that, but it doesn't work for me.
It's working now, thank's!
Hello,
I would like to have a variable, that I can use after submitting the test like the
data._id
. Thanks for your great program!