-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
27171b6
commit 3cc2f61
Showing
31 changed files
with
465 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
{ | ||
"trailingComma": "all", | ||
"semi": true, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"jsxSingleQuote": true, | ||
"plugins": [] | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
'use server'; | ||
"use server"; | ||
|
||
import { addReviewToRestaurant } from '@/src/lib/firebase/firestore.js'; | ||
import { getAuthenticatedAppForUser } from '@/src/lib/firebase/serverApp.js'; | ||
import { getFirestore } from 'firebase/firestore'; | ||
import { addReviewToRestaurant } from "@/src/lib/firebase/firestore.js"; | ||
import { getAuthenticatedAppForUser } from "@/src/lib/firebase/serverApp.js"; | ||
import { getFirestore } from "firebase/firestore"; | ||
|
||
// This is a Server Action | ||
// https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions | ||
export async function handleReviewFormSubmission(data) { | ||
const { firebaseServerApp } = await getAuthenticatedAppForUser(); | ||
const db = getFirestore(firebaseServerApp); | ||
|
||
await addReviewToRestaurant(db, data.get('restaurantId'), { | ||
text: data.get('text'), | ||
rating: data.get('rating'), | ||
await addReviewToRestaurant(db, data.get("restaurantId"), { | ||
text: data.get("text"), | ||
rating: data.get("rating"), | ||
|
||
// This came from a hidden form field | ||
userId: data.get('userId'), | ||
userId: data.get("userId"), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.