mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: submit function
This commit is contained in:
1 parent
1d3907201a
commit
ffda6a6bb7
2 files changed
+9
-8
No files matched your search
@@ -10,13 +10,13 @@
|
||||
import Dark from '$lib/images/support/support-wizard-dark.svg';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Collapsible, CollapsibleItem } from '$lib/components';
|
||||
import { user } from '$lib/stores/user';
|
||||
|
||||
$wizard.media = $app.themeInUse === 'dark' ? Dark : Light;
|
||||
|
||||
let files: FileList;
|
||||
|
||||
async function beforeSubmit() {
|
||||
console.log('test');
|
||||
const response = await fetch('https://growth.appwrite.io/v1/support', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -24,12 +24,13 @@
|
||||
},
|
||||
body: JSON.stringify({
|
||||
subject: 'support',
|
||||
email: $user.email,
|
||||
firstName: $user?.name ?? '',
|
||||
message: $supportData.message,
|
||||
email: 'test@email.com',
|
||||
tags: $supportData.tags
|
||||
tags: ['cloud'],
|
||||
customFields: [{ id: '41612', value: $supportData.category }]
|
||||
})
|
||||
});
|
||||
console.log(response);
|
||||
trackEvent('submit_support_ticket');
|
||||
if (response.status !== 200) {
|
||||
addNotification({
|
||||
@@ -53,9 +54,9 @@
|
||||
{#each ['General', 'Billing', 'Technical'] as topic}
|
||||
<Pill
|
||||
button
|
||||
selected={$supportData.tags.includes(topic.toLowerCase())}
|
||||
selected={$supportData.category === topic.toLowerCase()}
|
||||
on:click={() => {
|
||||
$supportData.tags = [topic.toLocaleLowerCase()];
|
||||
$supportData.category = topic.toLocaleLowerCase();
|
||||
}}>{topic}</Pill>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -2,12 +2,12 @@ import { writable } from 'svelte/store';
|
||||
|
||||
export type SupportData = {
|
||||
message: string;
|
||||
tags: string[];
|
||||
category: string;
|
||||
file?: File | null;
|
||||
};
|
||||
|
||||
export const supportData = writable<SupportData>({
|
||||
message: '',
|
||||
tags: ['general'],
|
||||
category: 'general',
|
||||
file: null
|
||||
});
|
||||
Reference in new issue
Block a user