Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove supabase dependency #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adamjonas
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Jul 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chat-btc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 27, 2023 2:14pm

urvishp80
urvishp80 previously approved these changes Jul 25, 2023
Copy link
Contributor

@Extheoisah Extheoisah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a few comments.

src/database/database.ts Outdated Show resolved Hide resolved

export const addFeedback = async (feedback: FeedbackPayload, feedbackId: string) => {
const { status, error } = await SupaBaseDatabase.getInstance().addFeedback({
...feedback,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to spread the feedback object. Pass it directly.

Suggested change
...feedback,
feedback,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this from my linter when I change to your suggestion:

Argument of type '{ feedback: FeedbackPayload; feedbackId: string; }' is not assignable to parameter of type 'FeedbackPayload'. Object literal may only specify known properties, but 'feedback' does not exist in type 'FeedbackPayload'. Did you mean to write 'feedbackId'?ts(2345)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. its a type issue but this is fine too

setIsFeedbackSubmitted(true);
console.log("Feedback sent successfully");
if (isSupabaseInitialized) {
await addFeedback(feedback, feedbackId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function returns true or false, we should assign the return value a variable and check if the feedback was submitted. Only then should we setFeedBackSubmitted to true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this is a hack to get the page to close.

}
setIsFeedbackSubmitted(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to do this if the db isn't initialised

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the only way that the page closes

Copy link
Contributor

@Extheoisah Extheoisah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this in. we'll fix the nits in a later pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 👀 In Review
Development

Successfully merging this pull request may close these issues.

4 participants