v1.0.0/release
finalize update and set logic
This commit is contained in:
@@ -0,0 +1,108 @@
|
|||||||
|
[debug] [2021-04-14T15:02:44.296Z] ----------------------------------------------------------------------
|
||||||
|
[debug] [2021-04-14T15:02:44.297Z] Command: C:\Program Files\nodejs\node.exe C:\Users\ayush\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js deploy --only functions
|
||||||
|
[debug] [2021-04-14T15:02:44.298Z] CLI Version: 9.10.0
|
||||||
|
[debug] [2021-04-14T15:02:44.298Z] Platform: win32
|
||||||
|
[debug] [2021-04-14T15:02:44.298Z] Node Version: v12.19.0
|
||||||
|
[debug] [2021-04-14T15:02:44.299Z] Time: Wed Apr 14 2021 11:02:44 GMT-0400 (Eastern Daylight Time)
|
||||||
|
[debug] [2021-04-14T15:02:44.299Z] ----------------------------------------------------------------------
|
||||||
|
[debug]
|
||||||
|
[debug] [2021-04-14T15:02:44.304Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
||||||
|
[debug] [2021-04-14T15:02:44.305Z] > authorizing via signed-in user (ayushyamitabh@gmail.com)
|
||||||
|
[debug] [2021-04-14T15:02:44.305Z] [iam] checking project vaxandme for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
|
||||||
|
[debug] [2021-04-14T15:02:44.306Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/vaxandme:testIamPermissions
|
||||||
|
{"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
|
||||||
|
[debug] [2021-04-14T15:02:44.519Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:43 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","server-timing":"gfet4t7; dur=145","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[debug] [2021-04-14T15:02:44.520Z] >>> HTTP REQUEST POST https://iam.googleapis.com/v1/projects/vaxandme/serviceAccounts/vaxandme@appspot.gserviceaccount.com:testIamPermissions
|
||||||
|
{"permissions":["iam.serviceAccounts.actAs"]}
|
||||||
|
[debug] [2021-04-14T15:02:44.740Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:43 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[info]
|
||||||
|
[info] === Deploying to 'vaxandme'...
|
||||||
|
[info]
|
||||||
|
[info] i deploying functions
|
||||||
|
[info] Running command: npm --prefix "$RESOURCE_DIR" run lint
|
||||||
|
[info] Running command: npm --prefix "$RESOURCE_DIR" run build
|
||||||
|
[info] + functions: Finished running predeploy script.
|
||||||
|
[info] i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
|
||||||
|
[info] i functions: ensuring required API cloudbuild.googleapis.com is enabled...
|
||||||
|
[debug] [2021-04-14T15:02:56.281Z] >>> HTTP REQUEST GET https://serviceusage.googleapis.com/v1/projects/vaxandme/services/cloudfunctions.googleapis.com
|
||||||
|
|
||||||
|
[debug] [2021-04-14T15:02:56.281Z] >>> HTTP REQUEST GET https://serviceusage.googleapis.com/v1/projects/vaxandme/services/runtimeconfig.googleapis.com
|
||||||
|
|
||||||
|
[debug] [2021-04-14T15:02:56.281Z] >>> HTTP REQUEST GET https://serviceusage.googleapis.com/v1/projects/vaxandme/services/cloudbuild.googleapis.com
|
||||||
|
|
||||||
|
[debug] [2021-04-14T15:02:56.702Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:55 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[debug] [2021-04-14T15:02:56.702Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:55 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[info] + functions: required API cloudbuild.googleapis.com is enabled
|
||||||
|
[debug] [2021-04-14T15:02:56.728Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:55 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[info] + functions: required API cloudfunctions.googleapis.com is enabled
|
||||||
|
[debug] [2021-04-14T15:02:56.729Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/vaxandme/adminSdkConfig
|
||||||
|
|
||||||
|
[debug] [2021-04-14T15:02:56.994Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:55 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[info] i functions: preparing functions directory for uploading...
|
||||||
|
[debug] [2021-04-14T15:02:56.995Z] >>> HTTP REQUEST GET https://runtimeconfig.googleapis.com/v1beta1/projects/vaxandme/configs
|
||||||
|
|
||||||
|
[debug] [2021-04-14T15:02:57.329Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:56 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[info] i functions: packaged functions (48.93 KB) for uploading
|
||||||
|
[debug] [2021-04-14T15:02:57.499Z] > [functions] package.json contents: {
|
||||||
|
"name": "functions",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --ext .js,.ts .",
|
||||||
|
"build": "tsc",
|
||||||
|
"serve": "npm run build && firebase emulators:start --only functions",
|
||||||
|
"shell": "npm run build && firebase functions:shell",
|
||||||
|
"start": "npm run shell",
|
||||||
|
"deploy": "firebase deploy --only functions",
|
||||||
|
"logs": "firebase functions:log"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "12"
|
||||||
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"firebase-admin": "^9.2.0",
|
||||||
|
"firebase-functions": "^3.11.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
||||||
|
"@typescript-eslint/parser": "^3.8.0",
|
||||||
|
"eslint": "^7.6.0",
|
||||||
|
"eslint-config-google": "^0.14.0",
|
||||||
|
"eslint-plugin-import": "^2.22.0",
|
||||||
|
"firebase-functions-test": "^0.2.0",
|
||||||
|
"typescript": "^3.8.0"
|
||||||
|
},
|
||||||
|
"private": true
|
||||||
|
}
|
||||||
|
[debug] [2021-04-14T15:02:57.500Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/projects/vaxandme/locations/-/functions
|
||||||
|
|
||||||
|
[debug] [2021-04-14T15:02:59.025Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:58 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[debug] [2021-04-14T15:02:59.026Z] >>> HTTP REQUEST POST https://cloudfunctions.googleapis.com/v1/projects/vaxandme/locations/us-central1/functions:generateUploadUrl
|
||||||
|
|
||||||
|
[debug] [2021-04-14T15:02:59.617Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:58 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[debug] [2021-04-14T15:02:59.617Z] >>> HTTP REQUEST PUT https://storage.googleapis.com/gcf-upload-us-central1-a3e8d99e-f910-4259-8532-3499c31a2b18/d09fdf34-2465-4273-a031-cf401455649d.zip?GoogleAccessId=service-614738281692@gcf-admin-robot.iam.gserviceaccount.com&Expires=1618414378&Signature=IgSMxAXuyn%2B5KFFWn5ocmdXb0kCD7pCpVkJ7DlBGrYzozBNE0%2FbsTPs1kloWKXBbZXTVIQEp6K9kmxDzV74pYgG7kIfxlDXvyOKoz61Tac7JiCOiWtOoyN8KJRQFC2J4D4jqvL4Mp%2BaA3ndFWD50OWiB%2F6O%2FdpVPbTAI7SqJsrzxyV92MYA02R7n2AWvvpYOsZsGivU0WI70ZI3aQLdqzVFgV9WaV6Vk9zRtwCWHQNLwQ7nTw3ixhIpU%2BFtDcYe67DB8AeHNWnI71sR4ksdT5kV1sjpgf2pc45l%2BKATPoIgOHLPCgDfM6Io64xEUzBG0TK3eLXiEi00bGHwfbd8N4g%3D%3D
|
||||||
|
<request body omitted>
|
||||||
|
[debug] [2021-04-14T15:02:59.802Z] <<< HTTP RESPONSE 200 {"x-guploader-uploadid":"ABg5-UxK4At3xlowXTiYdn0rHwGayMkbEeI59N2pKrCSFzbO56f8rqSbXtYm41zJGuBNBWb4pla8OkpyH-0-LQqlzdmCGPHMFQ","etag":"\"d549deb979878a67ee673172d8034ae6\"","x-goog-generation":"1618412578780488","x-goog-metageneration":"1","x-goog-hash":"crc32c=Q6RTyA==, md5=1UneuXmHimfuZzFy2ANK5g==","x-goog-stored-content-length":"50100","x-goog-stored-content-encoding":"identity","vary":"Origin","content-length":"0","date":"Wed, 14 Apr 2021 15:02:58 GMT","server":"UploadServer","content-type":"text/html; charset=UTF-8","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""}
|
||||||
|
[info] + functions: functions folder uploaded successfully
|
||||||
|
[info] i functions: updating Node.js 12 function saveResult(us-central1)...
|
||||||
|
[debug] [2021-04-14T15:02:59.805Z] >>> HTTP REQUEST PATCH https://cloudfunctions.googleapis.com/v1/projects/vaxandme/locations/us-central1/functions/saveResult {"updateMask":"sourceUploadUrl,name,labels,runtime,environmentVariables,httpsTrigger"}
|
||||||
|
{"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-a3e8d99e-f910-4259-8532-3499c31a2b18/d09fdf34-2465-4273-a031-cf401455649d.zip?GoogleAccessId=service-614738281692@gcf-admin-robot.iam.gserviceaccount.com&Expires=1618414378&Signature=IgSMxAXuyn%2B5KFFWn5ocmdXb0kCD7pCpVkJ7DlBGrYzozBNE0%2FbsTPs1kloWKXBbZXTVIQEp6K9kmxDzV74pYgG7kIfxlDXvyOKoz61Tac7JiCOiWtOoyN8KJRQFC2J4D4jqvL4Mp%2BaA3ndFWD50OWiB%2F6O%2FdpVPbTAI7SqJsrzxyV92MYA02R7n2AWvvpYOsZsGivU0WI70ZI3aQLdqzVFgV9WaV6Vk9zRtwCWHQNLwQ7nTw3ixhIpU%2BFtDcYe67DB8AeHNWnI71sR4ksdT5kV1sjpgf2pc45l%2BKATPoIgOHLPCgDfM6Io64xEUzBG0TK3eLXiEi00bGHwfbd8N4g%3D%3D","name":"projects/vaxandme/locations/us-central1/functions/saveResult","labels":{"deployment-tool":"cli-firebase","deployment-callable":"true"},"httpsTrigger":{},"runtime":"nodejs12","environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"vaxandme\",\"storageBucket\":\"vaxandme.appspot.com\",\"locationId\":\"us-central\"}"}}
|
||||||
|
[debug] [2021-04-14T15:03:00.310Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Wed, 14 Apr 2021 15:02:59 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[debug] [2021-04-14T15:03:00.312Z] > refreshing access token with scopes: []
|
||||||
|
[debug] [2021-04-14T15:03:00.312Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
|
||||||
|
<request body omitted>
|
||||||
|
[debug] [2021-04-14T15:03:00.406Z] <<< HTTP RESPONSE 200 {"date":"Wed, 14 Apr 2021 15:02:59 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","pragma":"no-cache","expires":"Mon, 01 Jan 1990 00:00:00 GMT","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
|
||||||
|
[debug] [2021-04-14T15:03:00.414Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw [none]
|
||||||
|
[debug] [2021-04-14T15:03:00.609Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw 200
|
||||||
|
[debug] [2021-04-14T15:03:00.609Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw {"name":"operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw","metadata":{"@type":"type.googleapis.com/google.cloud.functions.v1.OperationMetadataV1","target":"projects/vaxandme/locations/us-central1/functions/saveResult","type":"UPDATE_FUNCTION","request":{"@type":"type.googleapis.com/google.cloud.functions.v1.CloudFunction","name":"projects/vaxandme/locations/us-central1/functions/saveResult","httpsTrigger":{},"status":"ACTIVE","entryPoint":"saveResult","timeout":"60s","availableMemoryMb":256,"serviceAccountEmail":"vaxandme@appspot.gserviceaccount.com","updateTime":"2021-04-14T05:16:08.489Z","versionId":"2","labels":{"deployment-tool":"cli-firebase","deployment-callable":"true"},"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-a3e8d99e-f910-4259-8532-3499c31a2b18/d09fdf34-2465-4273-a031-cf401455649d.zip?GoogleAccessId=service-614738281692@gcf-admin-robot.iam.gserviceaccount.com&Expires=1618414378&Signature=IgSMxAXuyn%2B5KFFWn5ocmdXb0kCD7pCpVkJ7DlBGrYzozBNE0%2FbsTPs1kloWKXBbZXTVIQEp6K9kmxDzV74pYgG7kIfxlDXvyOKoz61Tac7JiCOiWtOoyN8KJRQFC2J4D4jqvL4Mp%2BaA3ndFWD50OWiB%2F6O%2FdpVPbTAI7SqJsrzxyV92MYA02R7n2AWvvpYOsZsGivU0WI70ZI3aQLdqzVFgV9WaV6Vk9zRtwCWHQNLwQ7nTw3ixhIpU%2BFtDcYe67DB8AeHNWnI71sR4ksdT5kV1sjpgf2pc45l%2BKATPoIgOHLPCgDfM6Io64xEUzBG0TK3eLXiEi00bGHwfbd8N4g%3D%3D","environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"vaxandme\",\"storageBucket\":\"vaxandme.appspot.com\",\"locationId\":\"us-central\"}"},"runtime":"nodejs12","ingressSettings":"ALLOW_ALL","buildId":"a35fdaab-c6e7-4ac2-b168-c8f2648884dd"},"versionId":"3","updateTime":"2021-04-14T15:02:59Z"}}
|
||||||
|
[debug] [2021-04-14T15:03:01.116Z] [update-projects/vaxandme/locations/us-central1/functions/saveResult] Retrying task index 0
|
||||||
|
[debug] [2021-04-14T15:03:01.116Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw [none]
|
||||||
|
[debug] [2021-04-14T15:03:01.298Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw 200
|
||||||
|
[debug] [2021-04-14T15:03:01.298Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw {"name":"operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw","metadata":{"@type":"type.googleapis.com/google.cloud.functions.v1.OperationMetadataV1","target":"projects/vaxandme/locations/us-central1/functions/saveResult","type":"UPDATE_FUNCTION","request":{"@type":"type.googleapis.com/google.cloud.functions.v1.CloudFunction","name":"projects/vaxandme/locations/us-central1/functions/saveResult","httpsTrigger":{},"status":"ACTIVE","entryPoint":"saveResult","timeout":"60s","availableMemoryMb":256,"serviceAccountEmail":"vaxandme@appspot.gserviceaccount.com","updateTime":"2021-04-14T05:16:08.489Z","versionId":"2","labels":{"deployment-tool":"cli-firebase","deployment-callable":"true"},"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-a3e8d99e-f910-4259-8532-3499c31a2b18/d09fdf34-2465-4273-a031-cf401455649d.zip?GoogleAccessId=service-614738281692@gcf-admin-robot.iam.gserviceaccount.com&Expires=1618414378&Signature=IgSMxAXuyn%2B5KFFWn5ocmdXb0kCD7pCpVkJ7DlBGrYzozBNE0%2FbsTPs1kloWKXBbZXTVIQEp6K9kmxDzV74pYgG7kIfxlDXvyOKoz61Tac7JiCOiWtOoyN8KJRQFC2J4D4jqvL4Mp%2BaA3ndFWD50OWiB%2F6O%2FdpVPbTAI7SqJsrzxyV92MYA02R7n2AWvvpYOsZsGivU0WI70ZI3aQLdqzVFgV9WaV6Vk9zRtwCWHQNLwQ7nTw3ixhIpU%2BFtDcYe67DB8AeHNWnI71sR4ksdT5kV1sjpgf2pc45l%2BKATPoIgOHLPCgDfM6Io64xEUzBG0TK3eLXiEi00bGHwfbd8N4g%3D%3D","environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"vaxandme\",\"storageBucket\":\"vaxandme.appspot.com\",\"locationId\":\"us-central\"}"},"runtime":"nodejs12","ingressSettings":"ALLOW_ALL","buildId":"a35fdaab-c6e7-4ac2-b168-c8f2648884dd"},"versionId":"3","updateTime":"2021-04-14T15:02:59Z"}}
|
||||||
|
[debug] [2021-04-14T15:03:02.307Z] [update-projects/vaxandme/locations/us-central1/functions/saveResult] Retrying task index 0
|
||||||
|
[debug] [2021-04-14T15:03:02.307Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw [none]
|
||||||
|
[debug] [2021-04-14T15:03:02.607Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw 200
|
||||||
|
[debug] [2021-04-14T15:03:02.608Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw {"name":"operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw","metadata":{"@type":"type.googleapis.com/google.cloud.functions.v1.OperationMetadataV1","target":"projects/vaxandme/locations/us-central1/functions/saveResult","type":"UPDATE_FUNCTION","request":{"@type":"type.googleapis.com/google.cloud.functions.v1.CloudFunction","name":"projects/vaxandme/locations/us-central1/functions/saveResult","httpsTrigger":{},"status":"ACTIVE","entryPoint":"saveResult","timeout":"60s","availableMemoryMb":256,"serviceAccountEmail":"vaxandme@appspot.gserviceaccount.com","updateTime":"2021-04-14T05:16:08.489Z","versionId":"2","labels":{"deployment-tool":"cli-firebase","deployment-callable":"true"},"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-a3e8d99e-f910-4259-8532-3499c31a2b18/d09fdf34-2465-4273-a031-cf401455649d.zip?GoogleAccessId=service-614738281692@gcf-admin-robot.iam.gserviceaccount.com&Expires=1618414378&Signature=IgSMxAXuyn%2B5KFFWn5ocmdXb0kCD7pCpVkJ7DlBGrYzozBNE0%2FbsTPs1kloWKXBbZXTVIQEp6K9kmxDzV74pYgG7kIfxlDXvyOKoz61Tac7JiCOiWtOoyN8KJRQFC2J4D4jqvL4Mp%2BaA3ndFWD50OWiB%2F6O%2FdpVPbTAI7SqJsrzxyV92MYA02R7n2AWvvpYOsZsGivU0WI70ZI3aQLdqzVFgV9WaV6Vk9zRtwCWHQNLwQ7nTw3ixhIpU%2BFtDcYe67DB8AeHNWnI71sR4ksdT5kV1sjpgf2pc45l%2BKATPoIgOHLPCgDfM6Io64xEUzBG0TK3eLXiEi00bGHwfbd8N4g%3D%3D","environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"vaxandme\",\"storageBucket\":\"vaxandme.appspot.com\",\"locationId\":\"us-central\"}"},"runtime":"nodejs12","ingressSettings":"ALLOW_ALL","buildId":"a35fdaab-c6e7-4ac2-b168-c8f2648884dd"},"versionId":"3","updateTime":"2021-04-14T15:02:59Z"}}
|
||||||
|
[debug] [2021-04-14T15:03:04.617Z] [update-projects/vaxandme/locations/us-central1/functions/saveResult] Retrying task index 0
|
||||||
|
[debug] [2021-04-14T15:03:04.617Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw [none]
|
||||||
|
[debug] [2021-04-14T15:03:04.803Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw 200
|
||||||
|
[debug] [2021-04-14T15:03:04.803Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw {"name":"operations/dmF4YW5kbWUvdXMtY2VudHJhbDEvc2F2ZVJlc3VsdC9mNlM4ejJPRXZ4bw","metadata":{"@type":"type.googleapis.com/google.cloud.functions.v1.OperationMetadataV1","target":"projects/vaxandme/locations/us-central1/functions/saveResult","type":"UPDATE_FUNCTION","request":{"@type":"type.googleapis.com/google.cloud.functions.v1.CloudFunction","name":"projects/vaxandme/locations/us-central1/functions/saveResult","httpsTrigger":{},"status":"ACTIVE","entryPoint":"saveResult","timeout":"60s","availableMemoryMb":256,"serviceAccountEmail":"vaxandme@appspot.gserviceaccount.com","updateTime":"2021-04-14T05:16:08.489Z","versionId":"2","labels":{"deployment-tool":"cli-firebase","deployment-callable":"true"},"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-a3e8d99e-f910-4259-8532-3499c31a2b18/d09fdf34-2465-4273-a031-cf401455649d.zip?GoogleAccessId=service-614738281692@gcf-admin-robot.iam.gserviceaccount.com&Expires=1618414378&Signature=IgSMxAXuyn%2B5KFFWn5ocmdXb0kCD7pCpVkJ7DlBGrYzozBNE0%2FbsTPs1kloWKXBbZXTVIQEp6K9kmxDzV74pYgG7kIfxlDXvyOKoz61Tac7JiCOiWtOoyN8KJRQFC2J4D4jqvL4Mp%2BaA3ndFWD50OWiB%2F6O%2FdpVPbTAI7SqJsrzxyV92MYA02R7n2AWvvpYOsZsGivU0WI70ZI3aQLdqzVFgV9WaV6Vk9zRtwCWHQNLwQ7nTw3ixhIpU%2BFtDcYe67DB8AeHNWnI71sR4ksdT5kV1sjpgf2pc45l%2BKATPoIgOHLPCgDfM6Io64xEUzBG0TK3eLXiEi00bGHwfbd8N4g%3D%3D","environmentVariables":{"FIREBASE_CONFIG":"{\"projectId\":\"vaxandme\",\"storageBucket\":\"vaxandme.appspot.com\",\"locationId\":\"us-central\"}"},"runtime":"nodejs12","ingressSettings":"ALLOW_ALL","buildId":"a35fdaab-c6e7-4ac2-b168-c8f2648884dd"},"versionId":"3","updateTime":"2021-04-14T15:02:59Z","buildId":"ba9f100c-ace5-49f6-9373-ed33e15f4330"}}
|
||||||
+70
-3
@@ -25,14 +25,81 @@ const serializeGaId = (_gaid) => {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
exports.saveResult = functions.https.onCall((data, context) => {
|
exports.saveResult = functions.https.onCall(async (data, context) => {
|
||||||
if (!!data && !!context) {
|
if (!!data && !!context) {
|
||||||
const { gid } = data;
|
const { gid } = data;
|
||||||
const docId = serializeGaId(gid);
|
const docId = serializeGaId(gid);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const docData = Object.assign({}, data);
|
const docData = Object.assign({}, data);
|
||||||
delete docData.gid;
|
delete docData.gid;
|
||||||
admin.firestore().collection("results").doc(docId).set(docData);
|
const existingData = await admin
|
||||||
|
.firestore()
|
||||||
|
.collection("results")
|
||||||
|
.doc(docId)
|
||||||
|
.get()
|
||||||
|
.then((doc) => doc.data());
|
||||||
|
delete docData.age;
|
||||||
|
delete docData.name;
|
||||||
|
delete docData.dose;
|
||||||
|
if (existingData !== undefined && existingData !== docData) {
|
||||||
|
// DATA EXISTS FOR USER
|
||||||
|
// BUT DIFF DATA SENT FOR UPDATE
|
||||||
|
await admin.firestore().collection("results").doc(docId).set(docData);
|
||||||
|
const updateDoc = {};
|
||||||
|
Object.keys(docData).forEach((symptom) => {
|
||||||
|
// IF WAS TRUE, NOW FALSE = -1
|
||||||
|
// IF WAS TRUE, NOW TRUE = 0
|
||||||
|
// IF WAS FALSE, NOW TRUE = +1
|
||||||
|
// IF WAS FALSE, NOW FALSE = 0
|
||||||
|
let incrementValue = 0;
|
||||||
|
if (existingData[symptom] === true && docData[symptom] === false) {
|
||||||
|
incrementValue = -1;
|
||||||
|
}
|
||||||
|
else if (existingData[symptom] === false &&
|
||||||
|
docData[symptom] === true) {
|
||||||
|
incrementValue = 1;
|
||||||
|
}
|
||||||
|
if (data.dose) {
|
||||||
|
updateDoc[`${data.dose}.${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(incrementValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
updateDoc[`${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(incrementValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
admin
|
||||||
|
.firestore()
|
||||||
|
.collection("stats")
|
||||||
|
.doc(data.name)
|
||||||
|
.update(updateDoc);
|
||||||
|
}
|
||||||
|
else if (existingData === undefined) {
|
||||||
|
// DATA DOESN'T EXIST FOR USER
|
||||||
|
// SAVE USER DATA
|
||||||
|
await admin.firestore().collection("results").doc(docId).set(docData);
|
||||||
|
// INCREMENT TOTAL RESPONSE COUNT
|
||||||
|
const updateDoc = {
|
||||||
|
count: admin.firestore.FieldValue.increment(1),
|
||||||
|
};
|
||||||
|
// INCREMENT VALUES FOR EACH SYMPTOM
|
||||||
|
Object.keys(docData).forEach((symptom) => {
|
||||||
|
if (docData[symptom] === true) {
|
||||||
|
if (data.dose) {
|
||||||
|
updateDoc[`${data.dose}.${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
updateDoc[`${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
admin
|
||||||
|
.firestore()
|
||||||
|
.collection("stats")
|
||||||
|
.doc(data.name)
|
||||||
|
.update(updateDoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
exports.getPastResult = functions.https.onCall(async (data, context) => {
|
exports.getPastResult = functions.https.onCall(async (data, context) => {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAgD;AAChD,wCAAwC;AACxC,wDAAwD;AAExD,MAAM,MA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
|
||||||
|
|
||||||
export const saveResult = functions.https.onCall(
|
export const saveResult = functions.https.onCall(
|
||||||
(data: SaveResultRequestData, context) => {
|
async (data: SaveResultRequestData, context) => {
|
||||||
if (!!data && !!context) {
|
if (!!data && !!context) {
|
||||||
const {gid} = data;
|
const {gid} = data;
|
||||||
const docId: string = serializeGaId(gid);
|
const docId: string = serializeGaId(gid);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
const docData: Record<string, string | boolean> =
|
||||||
const docData : any = Object.assign({}, data);
|
Object.assign({}, data);
|
||||||
delete docData.gid;
|
delete docData.gid;
|
||||||
admin.firestore().collection("results").doc(docId).set(docData);
|
const existingData = await admin
|
||||||
|
.firestore()
|
||||||
|
.collection("results")
|
||||||
|
.doc(docId)
|
||||||
|
.get()
|
||||||
|
.then((doc) => doc.data());
|
||||||
|
delete docData.age;
|
||||||
|
delete docData.name;
|
||||||
|
delete docData.dose;
|
||||||
|
if (existingData !== undefined && existingData !== docData) {
|
||||||
|
// DATA EXISTS FOR USER
|
||||||
|
// BUT DIFF DATA SENT FOR UPDATE
|
||||||
|
await admin.firestore().collection("results").doc(docId).set(docData);
|
||||||
|
const updateDoc : Record<string, admin.firestore.FieldValue> = {};
|
||||||
|
Object.keys(docData).forEach((symptom : string) => {
|
||||||
|
// IF WAS TRUE, NOW FALSE = -1
|
||||||
|
// IF WAS TRUE, NOW TRUE = 0
|
||||||
|
// IF WAS FALSE, NOW TRUE = +1
|
||||||
|
// IF WAS FALSE, NOW FALSE = 0
|
||||||
|
let incrementValue = 0;
|
||||||
|
if (existingData[symptom] === true && docData[symptom] === false) {
|
||||||
|
incrementValue = -1;
|
||||||
|
} else if (existingData[symptom] === false &&
|
||||||
|
docData[symptom] === true) {
|
||||||
|
incrementValue = 1;
|
||||||
|
}
|
||||||
|
if (data.dose) {
|
||||||
|
updateDoc[`${data.dose}.${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(incrementValue);
|
||||||
|
} else {
|
||||||
|
updateDoc[`${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(incrementValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
admin
|
||||||
|
.firestore()
|
||||||
|
.collection("stats")
|
||||||
|
.doc(data.name)
|
||||||
|
.update(updateDoc);
|
||||||
|
} else if (existingData === undefined) {
|
||||||
|
// DATA DOESN'T EXIST FOR USER
|
||||||
|
// SAVE USER DATA
|
||||||
|
await admin.firestore().collection("results").doc(docId).set(docData);
|
||||||
|
// INCREMENT TOTAL RESPONSE COUNT
|
||||||
|
const updateDoc : Record<string, admin.firestore.FieldValue> = {
|
||||||
|
count: admin.firestore.FieldValue.increment(1),
|
||||||
|
};
|
||||||
|
// INCREMENT VALUES FOR EACH SYMPTOM
|
||||||
|
Object.keys(docData).forEach((symptom : string) => {
|
||||||
|
if (docData[symptom] === true) {
|
||||||
|
if (data.dose) {
|
||||||
|
updateDoc[`${data.dose}.${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(1);
|
||||||
|
} else {
|
||||||
|
updateDoc[`${data.age}.${symptom}`] =
|
||||||
|
admin.firestore.FieldValue.increment(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
admin
|
||||||
|
.firestore()
|
||||||
|
.collection("stats")
|
||||||
|
.doc(data.name)
|
||||||
|
.update(updateDoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export const getPastResult = functions.https.onCall(async (data, context) => {
|
export const getPastResult = functions.https.onCall(async (data, context) => {
|
||||||
if (!!data && !!context) {
|
if (!!data && !!context) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
Web / API server started at http://localhost:4001
|
Web / API server started at http://localhost:4000
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
.input-popup.expanded {
|
.input-popup.expanded {
|
||||||
height: 40vh;
|
height: 40vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-bar-container {
|
||||||
|
max-width: 25%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -242,9 +242,9 @@ a {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
animation: 0.5s ease-out 0s 1 slideUp;
|
animation: 0.5s ease-out 0s 1 slideUp;
|
||||||
animation-delay: 1s;
|
animation-delay: 0.5s;
|
||||||
animation-fill-mode: forwards;
|
animation-fill-mode: forwards;
|
||||||
transform: translateY(300%);
|
transform: translateY(200%);
|
||||||
}
|
}
|
||||||
.input-popup * {
|
.input-popup * {
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
@@ -312,6 +312,29 @@ a {
|
|||||||
background-color: #55c16c;
|
background-color: #55c16c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes loading {
|
||||||
|
0% {
|
||||||
|
width: 0%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.loading-bar-container {
|
||||||
|
min-height: 2rem;
|
||||||
|
background-color: var(--color-secondary-light);
|
||||||
|
border-radius: 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.loading-bar {
|
||||||
|
position: relative;
|
||||||
|
width: 1rem;
|
||||||
|
min-height: 2rem;
|
||||||
|
background-color: #25d255;
|
||||||
|
border-radius: 1rem;
|
||||||
|
animation: 2s ease-out 0s infinite loading;
|
||||||
|
}
|
||||||
|
|
||||||
@media (hover: hover) and (pointer: fine) {
|
@media (hover: hover) and (pointer: fine) {
|
||||||
.answer:hover,
|
.answer:hover,
|
||||||
.answer.unselected:hover {
|
.answer.unselected:hover {
|
||||||
|
|||||||
@@ -24,3 +24,7 @@ footer {
|
|||||||
.input-popup.expanded {
|
.input-popup.expanded {
|
||||||
height: 50vh;
|
height: 50vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-bar-container {
|
||||||
|
max-width: 35%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -86,3 +86,7 @@ footer > div:last-of-type {
|
|||||||
.input-popup.expanded {
|
.input-popup.expanded {
|
||||||
height: 55vh;
|
height: 55vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-bar-container {
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.input-popup {
|
.input-popup {
|
||||||
height: 10rem;
|
height: 11rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-popup.expanded {
|
.input-popup.expanded {
|
||||||
|
|||||||
+38
-7
@@ -227,9 +227,11 @@ class App extends React.Component {
|
|||||||
gid: "",
|
gid: "",
|
||||||
showInputPopup: false,
|
showInputPopup: false,
|
||||||
answers: {},
|
answers: {},
|
||||||
|
loading: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
console.log(VAX_RESULTS);
|
||||||
const params = window.location.pathname
|
const params = window.location.pathname
|
||||||
.toUpperCase()
|
.toUpperCase()
|
||||||
.split("/")
|
.split("/")
|
||||||
@@ -262,10 +264,16 @@ class App extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!window.localStorage.getItem("hasExistingAnswer")) {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
}
|
||||||
|
|
||||||
if (window.gtag) {
|
if (window.gtag) {
|
||||||
window.gtag("get", "G-7VZCY223NG", "client_id", (client_id) => {
|
window.gtag("get", "G-7VZCY223NG", "client_id", (client_id) => {
|
||||||
|
if (!!client_id) {
|
||||||
this.setState({ gid: client_id });
|
this.setState({ gid: client_id });
|
||||||
getPastResult({ gid: client_id }).then((v) => {
|
getPastResult({ gid: client_id })
|
||||||
|
.then((v) => {
|
||||||
const { data } = v;
|
const { data } = v;
|
||||||
if (!!data) {
|
if (!!data) {
|
||||||
const { name, age, dose } = data;
|
const { name, age, dose } = data;
|
||||||
@@ -273,16 +281,26 @@ class App extends React.Component {
|
|||||||
delete data.name;
|
delete data.name;
|
||||||
delete data.age;
|
delete data.age;
|
||||||
delete data.dose;
|
delete data.dose;
|
||||||
this.setState({ answers: data });
|
this.setState({ answers: data, loading: false });
|
||||||
const inputPopupSubmit = document.querySelector(
|
const inputPopupSubmit = document.querySelector(
|
||||||
".input-popup-submit"
|
".input-popup-submit"
|
||||||
);
|
);
|
||||||
inputPopupSubmit.classList.add("submitted");
|
inputPopupSubmit.classList.add("submitted");
|
||||||
inputPopupSubmit.innerHTML = "UPDATE ANSWER";
|
inputPopupSubmit.innerHTML = "UPDATE ANSWER";
|
||||||
|
window.localStorage.setItem("hasExistingAnswer", true);
|
||||||
|
} else {
|
||||||
|
this.setState({ loading: false });
|
||||||
}
|
}
|
||||||
}).catch(err => console.error('ERROR Getting Past Answer', err));
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error("ERROR Getting Past Answer", err);
|
||||||
|
this.setState({ loading: false });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
shouldShowAgeGroup = () => {
|
shouldShowAgeGroup = () => {
|
||||||
const { name, dose } = this.state;
|
const { name, dose } = this.state;
|
||||||
@@ -378,7 +396,8 @@ class App extends React.Component {
|
|||||||
age,
|
age,
|
||||||
gid,
|
gid,
|
||||||
});
|
});
|
||||||
saveResult(submitAnswers).then(() => {
|
saveResult(submitAnswers)
|
||||||
|
.then(() => {
|
||||||
const inputPopupSubmit = document.querySelector(".input-popup-submit");
|
const inputPopupSubmit = document.querySelector(".input-popup-submit");
|
||||||
if (!inputPopupSubmit.classList.contains("submitted")) {
|
if (!inputPopupSubmit.classList.contains("submitted")) {
|
||||||
inputPopupSubmit.classList.add("submitted");
|
inputPopupSubmit.classList.add("submitted");
|
||||||
@@ -387,10 +406,11 @@ class App extends React.Component {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
inputPopupSubmit.innerHTML = "UPDATE ANSWER";
|
inputPopupSubmit.innerHTML = "UPDATE ANSWER";
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}).catch(err => console.error('ERROR Saving Answer', err));;
|
})
|
||||||
|
.catch((err) => console.error("ERROR Saving Answer", err));
|
||||||
};
|
};
|
||||||
render() {
|
render() {
|
||||||
const { name, dose, age, showInputPopup, answers } = this.state;
|
const { name, dose, age, showInputPopup, answers, loading } = this.state;
|
||||||
let result = {};
|
let result = {};
|
||||||
let resultAtSite = {};
|
let resultAtSite = {};
|
||||||
if (this.shouldShowResults()) {
|
if (this.shouldShowResults()) {
|
||||||
@@ -422,6 +442,17 @@ class App extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
{loading ? (
|
||||||
|
<div className="loading-container">
|
||||||
|
<p className="question" data-font="sans">
|
||||||
|
Checking for existing answers...
|
||||||
|
</p>
|
||||||
|
<div className="loading-bar-container">
|
||||||
|
<div className="loading-bar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
{!loading ? (
|
||||||
<div className="question-container">
|
<div className="question-container">
|
||||||
<p className="question" data-font="sans-italic">
|
<p className="question" data-font="sans-italic">
|
||||||
Select Vaccine
|
Select Vaccine
|
||||||
@@ -449,7 +480,7 @@ class App extends React.Component {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
{name && (name === VAX_NAMES.PB || name === VAX_NAMES.MD) ? (
|
{name && (name === VAX_NAMES.PB || name === VAX_NAMES.MD) ? (
|
||||||
<div className="question-container">
|
<div className="question-container">
|
||||||
<p className="question" data-font="sans-italic">
|
<p className="question" data-font="sans-italic">
|
||||||
|
|||||||
Reference in New Issue
Block a user