From 8acad60582b0fa3d9e183ee0fe5d9d48f2a48d9d Mon Sep 17 00:00:00 2001 From: Chris Milkaitis Date: Mon, 12 Apr 2021 20:51:04 -0400 Subject: [PATCH 1/9] Remove unused files --- functions/auth-code.js | 37 ------- functions/auth.js | 23 ---- functions/sign-up.js | 27 ----- src/routes/home/index.svelte | 104 ------------------ src/routes/home/thing.svelte | 115 -------------------- src/routes/sign-in/_helpers/submit-phone.js | 28 ----- src/routes/sign-in/code.svelte | 75 ------------- src/routes/sign-in/index.svelte | 38 ------- src/routes/sign-up.svelte | 51 --------- 9 files changed, 498 deletions(-) delete mode 100644 functions/auth-code.js delete mode 100644 functions/auth.js delete mode 100644 functions/sign-up.js delete mode 100644 src/routes/home/index.svelte delete mode 100644 src/routes/home/thing.svelte delete mode 100644 src/routes/sign-in/_helpers/submit-phone.js delete mode 100644 src/routes/sign-in/code.svelte delete mode 100644 src/routes/sign-in/index.svelte delete mode 100644 src/routes/sign-up.svelte diff --git a/functions/auth-code.js b/functions/auth-code.js deleted file mode 100644 index dc4fe13..0000000 --- a/functions/auth-code.js +++ /dev/null @@ -1,37 +0,0 @@ -import fetch from "node-fetch"; - -export async function handler(event, context, callback) { - console.log("Authenticating code..."); - - const { phone, code } = JSON.parse(event.body); - - console.log(`${phone}, ${code}`); - - const result = await fetch('https://starboardcoop-things-api.glitch.me/humans/auth/code', { - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - body: JSON.stringify({ phone, code }) - }); - - const { member, status } = await result.json(); - - console.log(member); - - const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; - - if (status != 200) - { - return { - statusCode: status, - body: JSON.stringify({error: `Your access code is invalid.`}) - } - } - - return { - statusCode: status, - body: JSON.stringify({ member: member, token: token }) - } -} \ No newline at end of file diff --git a/functions/auth.js b/functions/auth.js deleted file mode 100644 index 063d5d1..0000000 --- a/functions/auth.js +++ /dev/null @@ -1,23 +0,0 @@ -import fetch from "node-fetch"; - -export async function handler(event, context, callback) { - console.log("Signing in..."); - - const { phone } = JSON.parse(event.body); - - const result = await fetch('https://starboardcoop-things-api.glitch.me/humans/auth', { - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - body: JSON.stringify({ phone }) - }); - - const response = await result.json(); - - return { - statusCode: 200, - body: JSON.stringify(response) - } -} \ No newline at end of file diff --git a/functions/sign-up.js b/functions/sign-up.js deleted file mode 100644 index d4ba4bf..0000000 --- a/functions/sign-up.js +++ /dev/null @@ -1,27 +0,0 @@ -import fetch from "node-fetch"; - -export async function handler(event, context, callback) { - console.log("Signing up..."); - - const { phone, name } = JSON.parse(event.body); - - console.log(`${phone}, ${name}`); - - const result = await fetch('https://starboardcoop-things-api.glitch.me/humans/auth/enroll', { - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - body: JSON.stringify({ phone, name }) - }); - - const { member } = await result.json(); - - console.log(member); - - return { - statusCode: 200, - body: JSON.stringify({ member: member }) - } -} \ No newline at end of file diff --git a/src/routes/home/index.svelte b/src/routes/home/index.svelte deleted file mode 100644 index 19897f6..0000000 --- a/src/routes/home/index.svelte +++ /dev/null @@ -1,104 +0,0 @@ - - -
-
- Hi, {name}! -
- -
-
-
-
- {#if !data} - loading... - {:else} - {#if searchResults.length === 0} -
- - Recommended Things: - - -
- {#each data.categories as category} -
- - {category}: - - -
- {/each} - {:else} -
- - Things: - - -
- {/if} - {/if} -
-
-
\ No newline at end of file diff --git a/src/routes/home/thing.svelte b/src/routes/home/thing.svelte deleted file mode 100644 index 36c524e..0000000 --- a/src/routes/home/thing.svelte +++ /dev/null @@ -1,115 +0,0 @@ - - -
- pvd:thing -
- -
- - - - -
- - - {thing.name} -

👀

-
-
-
- {thing.name} - {thing.category} -
- - - Available: - Coming Soon! - - - - Typical out-of-pocket cost: - {thing.price} - - - - -
-
-
- - Description: - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - - Always practice safety while using all Things! -
-
-
- - \ No newline at end of file diff --git a/src/routes/sign-in/_helpers/submit-phone.js b/src/routes/sign-in/_helpers/submit-phone.js deleted file mode 100644 index ac2a7da..0000000 --- a/src/routes/sign-in/_helpers/submit-phone.js +++ /dev/null @@ -1,28 +0,0 @@ -import Session from '../../../session'; -import Phone from '../../../lib/phone'; - -export async function trySubmit(phoneText) { - const phone = new Phone(phoneText); - const invalid = !phone.isValid(); - - if (invalid) { - console.log('Invalid phone number.'); - return false; - } else { - const result = await fetch("/.netlify/functions/auth", { - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - body: JSON.stringify({ phone: phone.asNumber() }) - }); - - const data = await result.json(); - console.log(`Hi, ${data.name}!`); - - Session.update({ name: data.name, phone: phone.asNumber() }); - } - - return true; -} \ No newline at end of file diff --git a/src/routes/sign-in/code.svelte b/src/routes/sign-in/code.svelte deleted file mode 100644 index 94a9d46..0000000 --- a/src/routes/sign-in/code.svelte +++ /dev/null @@ -1,75 +0,0 @@ - - - - - -
-
- - -
-
\ No newline at end of file diff --git a/src/routes/sign-in/index.svelte b/src/routes/sign-in/index.svelte deleted file mode 100644 index 3bc6367..0000000 --- a/src/routes/sign-in/index.svelte +++ /dev/null @@ -1,38 +0,0 @@ - - -
-
- - -
-
\ No newline at end of file diff --git a/src/routes/sign-up.svelte b/src/routes/sign-up.svelte deleted file mode 100644 index 995f36b..0000000 --- a/src/routes/sign-up.svelte +++ /dev/null @@ -1,51 +0,0 @@ - - -
-
- invalid = false} - on:enter={submit} - type="text" - placeholder="Name" - /> - -
-
\ No newline at end of file From 95c3814ce600822fb822ca45a3a83c3dfde97f3a Mon Sep 17 00:00:00 2001 From: Chris Milkaitis Date: Mon, 12 Apr 2021 21:15:36 -0400 Subject: [PATCH 2/9] Fix padding on last thing in scroller --- src/components/Menu.svelte | 2 +- src/components/Scroller.svelte | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Menu.svelte b/src/components/Menu.svelte index e3f3c75..304ab41 100644 --- a/src/components/Menu.svelte +++ b/src/components/Menu.svelte @@ -35,7 +35,7 @@ -
+
-