From 2ef8150527d5780812f0afc89cd78d80a6ca10c9 Mon Sep 17 00:00:00 2001 From: jumson Date: Wed, 22 Nov 2023 17:07:54 -0500 Subject: [PATCH] Update +server.ts added comments and alternative code to bypass firebase --- src/routes/api/share/+server.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/routes/api/share/+server.ts b/src/routes/api/share/+server.ts index 5fd9ff4..1d0277b 100644 --- a/src/routes/api/share/+server.ts +++ b/src/routes/api/share/+server.ts @@ -1,9 +1,11 @@ import { error } from '@sveltejs/kit'; import type { Config } from '@sveltejs/adapter-vercel'; import type { RequestHandler } from './$types'; -import { ref, set, update } from 'firebase/database'; +// bypassing firebase +// import { ref, set, update } from 'firebase/database'; import { generateSlug } from 'random-word-slugs'; -import { db, loadChatFromDb } from '$misc/firebase'; +// bypassing firebase +// import { db, loadChatFromDb } from '$misc/firebase'; import type { Chat } from '$misc/shared'; import { respondToClient, throwIfUnset, getErrorMessage } from '$misc/error'; @@ -60,7 +62,9 @@ export const POST: RequestHandler = async ({ request }) => { }; // save to firebase - await set(ref(db, `sharedchats/${slug}`), documentToSave); + //await set(ref(db, `sharedchats/${slug}`), documentToSave); + // bypass + console.log('Saving document to Firebase:', documentToSave); return respondToClient({ slug, updateToken }); } catch (err) { @@ -95,7 +99,9 @@ export const DELETE: RequestHandler = async ({ request }) => { if (deleted.length) { // delete in firebase - await update(ref(db), updates); + // await update(ref(db), updates); + // bypass firebase + console.log('Deleting documents:', updates); } return respondToClient({ deleted });