diff --git a/mod.ts b/mod.ts index 9c4339a..c30837e 100644 --- a/mod.ts +++ b/mod.ts @@ -75,7 +75,7 @@ Deno.serve({ port: config.api.port }, async (req) => { return genericResponse(STATUS_CODE.OK, JSON.stringify(plans)); } else if (path.startsWith('/export/')) { - const userId = path.replace('/list/', ''); + const userId = path.replace('/export/', ''); const userMatch = await dbClient.query('SELECT id FROM users WHERE id = ?', [userId]).catch(() => { failed = true; }); @@ -83,7 +83,7 @@ Deno.serve({ port: config.api.port }, async (req) => { if (!userMatch.length) return genericResponse(STATUS_CODE.NotFound, 'User ID does not exist.'); // WIP: export plans to zip code goes here - return genericResponse(STATUS_CODE.NotImplemented, 'WIP'); + return genericResponse(STATUS_CODE.NotImplemented, 'Export function WIP.'); } } else if (req.method === 'POST' && path === '/enroll') { const body = await req.json(); diff --git a/ssr/buildHome.ts b/ssr/buildHome.ts index 25726c3..268d8e4 100644 --- a/ssr/buildHome.ts +++ b/ssr/buildHome.ts @@ -49,6 +49,11 @@ if(r.status===200){localStorage.setItem('name',userName);r.text().then((text)=>{ else{r.text().then((text)=>{alert(text);});} }); } +function exportPlans(){ +fetch('/api/export/${userId}') +.catch((e)=>{e.text().then((text)=>{alert(text);});}) +.then((r)=>{r.text().then((text)=>{alert(text);});}); +} function openPlan(planId){window.open(\`${config.api.publicDomain}#/share/\${planId}\`);} async function sharePlan(planId){ const link=\`${config.api.publicDomain}#/share/\${planId}\`; @@ -59,6 +64,7 @@ catch (error){prompt('Failed to copy to clipboard, please select and copy the li

This is a very basic management page. Please excuse the number of alert/prompts that will come up when you click on things as it was the quickest way to build it out.

Please note: anything modifying data will require you to enter your PIN again as both the web view you are looking at and server behind it are completely stateless for simplicity.

${userName}'s Plans:

+