1
0
Fork 0
mirror of synced 2024-10-02 01:56:57 +13:00

uses db to store feedback submissions status

This commit is contained in:
Keviin Åberg Kultalahti 2021-07-22 12:38:46 +02:00
parent a6814091b1
commit 558b58b051
2 changed files with 17 additions and 15 deletions

View file

@ -14,6 +14,8 @@
Divider, Divider,
Layout, Layout,
} from "@budibase/bbui" } from "@budibase/bbui"
import { auth } from "stores/portal"
let step = 0 let step = 0
let ratings = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] let ratings = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
let options = [ let options = [
@ -43,15 +45,21 @@
improvements, improvements,
comment, comment,
}) })
auth.updateSelf({
document.cookie = "feedbackSubmitted=true" flags: {
feedbackSubmitted: true,
dispatch("submitted") },
})
dispatch("complete")
} }
function cancelFeedback() { function cancelFeedback() {
document.cookie = "feedbackSubmitted=true" auth.updateSelf({
dispatch("submitted") flags: {
feedbackSubmitted: true,
},
})
dispatch("complete")
} }
</script> </script>

View file

@ -7,6 +7,7 @@
import VersionModal from "components/deploy/VersionModal.svelte" import VersionModal from "components/deploy/VersionModal.svelte"
import NPSFeedbackForm from "components/feedback/NPSFeedbackForm.svelte" import NPSFeedbackForm from "components/feedback/NPSFeedbackForm.svelte"
import { get } from "builderStore/api" import { get } from "builderStore/api"
import { auth } from "stores/portal"
import { isActive, goto, layout } from "@roxi/routify" import { isActive, goto, layout } from "@roxi/routify"
import Logo from "assets/bb-emblem.svg" import Logo from "assets/bb-emblem.svg"
import { capitalise } from "helpers" import { capitalise } from "helpers"
@ -21,15 +22,8 @@
let userShouldPostFeedback = false let userShouldPostFeedback = false
function checkIfUserHasSubmittedFeedback() {
return document.cookie
?.split("; ")
?.find(row => row.startsWith("feedbackSubmitted="))
?.split("=")[1]
}
function previewApp() { function previewApp() {
if (!checkIfUserHasSubmittedFeedback() === true) { if (!$auth?.user?.flags?.feedbackSubmitted === true) {
userShouldPostFeedback = true userShouldPostFeedback = true
} }
window.open(`/${application}`) window.open(`/${application}`)
@ -111,7 +105,7 @@
{/await} {/await}
{#if userShouldPostFeedback} {#if userShouldPostFeedback}
<NPSFeedbackForm on:submitted={() => (userShouldPostFeedback = false)} /> <NPSFeedbackForm on:complete={() => (userShouldPostFeedback = false)} />
{/if} {/if}
<style> <style>