Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/googleinterns/step121-2020
Browse files Browse the repository at this point in the history
…into AshaDevelopment
  • Loading branch information
aivey65 committed Aug 4, 2020
2 parents 21921c5 + 180ebe3 commit c7ac598
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,16 @@ app.post(
async (request, response) => {
const { body, datastoreKey: key, event } = request;
const [lat, long] = body.location;
const { name } = body;
const { name, address } = body;
event.users = event.users || {};
const userInfo = event.users[request.session.userID] || {};
event.users[request.session.userID] = { ...userInfo, name, lat, long };
event.users[request.session.userID] = {
...userInfo,
name,
lat,
long,
address,
};
datastore
// Datastore attaches a "symbol" (https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol)
// to any entities returned from a query. We don't want to store this attached metadata back into the database
Expand Down
10 changes: 8 additions & 2 deletions static/absolute/js/searchPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ window.onload = function () {
headers: window.HEADER_CONTENT_TYPE_JSON,
body: JSON.stringify({
name,
address,
location: [lat, long],
}),
});
Expand All @@ -66,8 +67,6 @@ window.onload = function () {
alert("error posting to api");
return;
}
nameInput.value = "";
addressInput.value = "";
});

document.getElementById("participants-btn").addEventListener("click", () => {
Expand Down Expand Up @@ -111,6 +110,13 @@ socket.on("refresh", () => {
async function refreshUI() {
const eventId = getEventId();

fetch(`/api/${eventId}/me`)
.then((response) => response.json())
.then(({ data: { name, address } = {} }) => {
document.getElementById("name-input").value = name ? name : "";
document.getElementById("address-input").value = address ? address : "";
});

let failure = false;
let map = null;
const LACoords = [34.052235, -118.243683];
Expand Down

0 comments on commit c7ac598

Please sign in to comment.