Skip to content

Commit

Permalink
Merge pull request #151 from appwrite/fix-feedback
Browse files Browse the repository at this point in the history
fix: feedback submission
  • Loading branch information
TorstenDittmann committed Nov 15, 2022
2 parents 49eec28 + 188ef54 commit de73c02
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
8 changes: 1 addition & 7 deletions src/lib/components/feedbackGeneral.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
let email: string;
async function handleSubmit() {
try {
await feedback.submitFeedback(
undefined,
email,
message,
['general'],
[{ firstname: name }]
);
await feedback.submitFeedback('feedback-general', message, name, email);
show = false;
} catch (error) {
show = false;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/feedbackNPS.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let name: string;
async function handleSubmit() {
try {
await feedback.submitFeedback(undefined, email, message, ['npm'], [{ value, name }]);
await feedback.submitFeedback('feedback-nps', message, name, email, value);
console.log(value, message);
feedback.switchType('general');
} catch (error) {
Expand Down
14 changes: 7 additions & 7 deletions src/lib/stores/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ function createFeedbackStore() {
});
},
submitFeedback: async (
subject?: string,
subject: string,
message: string,
firstname?: string,
email?: string,
message?: string,
tags?: string[],
customFields?: Record<string, unknown>[]
value?: number
) => {
const response = await fetch('https://growth.appwrite.io/v1/feedback', {
method: 'POST',
Expand All @@ -66,10 +66,10 @@ function createFeedbackStore() {
},
body: JSON.stringify({
subject,
email,
message,
tags,
customFields
email,
firstname: firstname ? firstname : undefined,
customFields: value ? [{ id: '40655', value }] : undefined
})
});
if (response.status !== 200) {
Expand Down

1 comment on commit de73c02

@vercel
Copy link

@vercel vercel bot commented on de73c02 Nov 15, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.