mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 14:42:32 -05:00
refactor routes
This commit is contained in:
1 parent
20ec614d3a
commit
ca7b9671f2
19 files changed
+173
-43
No files matched your search
@@ -41,6 +41,7 @@ safeRegisterElement('submission-form', class extends HTMLElement {
|
||||
language: this.dataset.language,
|
||||
paymentProvider: this.dataset.paymentProvider,
|
||||
dryRun: this.dataset.dryRun === 'true',
|
||||
viewToken: this.dataset.viewToken,
|
||||
expand: ['true', 'false'].includes(this.dataset.expand) ? this.dataset.expand === 'true' : null,
|
||||
withSignatureId: this.dataset.withSignatureId === 'true',
|
||||
requireSigningReason: this.dataset.requireSigningReason === 'true',
|
||||
|
||||
@@ -87,7 +87,7 @@ export default {
|
||||
IconCloudUpload,
|
||||
IconInnerShadowTop
|
||||
},
|
||||
inject: ['baseUrl', 't'],
|
||||
inject: ['baseUrl', 'fetchOptions', 't'],
|
||||
props: {
|
||||
message: {
|
||||
type: String,
|
||||
@@ -199,6 +199,7 @@ export default {
|
||||
|
||||
return fetch(this.baseUrl + '/api/attachments', {
|
||||
method: 'POST',
|
||||
headers: { ...this.fetchOptions.headers },
|
||||
body: formData
|
||||
}).then(async (resp) => {
|
||||
const data = await resp.json()
|
||||
|
||||
@@ -775,6 +775,7 @@ export default {
|
||||
provide () {
|
||||
return {
|
||||
baseUrl: this.baseUrl,
|
||||
fetchOptions: this.fetchOptions,
|
||||
scrollIntoArea: this.scrollIntoArea,
|
||||
scrollIntoField: this.scrollIntoField,
|
||||
t: this.t
|
||||
@@ -1002,6 +1003,11 @@ export default {
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
viewToken: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
attribution: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
@@ -1531,15 +1537,10 @@ export default {
|
||||
const newUrl = [window.location.pathname, queryParams.toString()].filter(Boolean).join('?')
|
||||
window.history.replaceState({}, document.title, newUrl)
|
||||
|
||||
return fetch(this.baseUrl + '/api/submitter_email_clicks', {
|
||||
return fetch(this.baseUrl + `/s/${this.submitterSlug}/click_email`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
t,
|
||||
submitter_slug: this.submitterSlug
|
||||
})
|
||||
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers },
|
||||
body: JSON.stringify({ t })
|
||||
})
|
||||
} else {
|
||||
return Promise.resolve({})
|
||||
@@ -1555,29 +1556,20 @@ export default {
|
||||
const newUrl = [window.location.pathname, queryParams.toString()].filter(Boolean).join('?')
|
||||
window.history.replaceState({}, document.title, newUrl)
|
||||
|
||||
return fetch(this.baseUrl + '/api/submitter_sms_clicks', {
|
||||
return fetch(this.baseUrl + `/s/${this.submitterSlug}/click_sms`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
c,
|
||||
submitter_slug: this.submitterSlug
|
||||
})
|
||||
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers },
|
||||
body: JSON.stringify({ c })
|
||||
})
|
||||
} else {
|
||||
return Promise.resolve({})
|
||||
}
|
||||
},
|
||||
trackViewForm () {
|
||||
fetch(this.baseUrl + '/api/submitter_form_views', {
|
||||
fetch(this.baseUrl + `/s/${this.submitterSlug}/view`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
submitter_slug: this.submitterSlug
|
||||
})
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ v: this.viewToken })
|
||||
})
|
||||
},
|
||||
previousSignatureValueFor (field) {
|
||||
|
||||
@@ -202,7 +202,7 @@ export default {
|
||||
MarkdownContent,
|
||||
IconArrowsDiagonalMinimize2
|
||||
},
|
||||
inject: ['baseUrl', 't'],
|
||||
inject: ['baseUrl', 'fetchOptions', 't'],
|
||||
props: {
|
||||
field: {
|
||||
type: Object,
|
||||
@@ -443,6 +443,7 @@ export default {
|
||||
|
||||
return fetch(this.baseUrl + '/api/attachments', {
|
||||
method: 'POST',
|
||||
headers: { ...this.fetchOptions.headers },
|
||||
body: formData
|
||||
}).then(async (resp) => {
|
||||
if (resp.status === 422 || resp.status === 500) {
|
||||
|
||||
@@ -376,7 +376,7 @@ export default {
|
||||
IconSignature,
|
||||
IconArrowsDiagonalMinimize2
|
||||
},
|
||||
inject: ['baseUrl', 't'],
|
||||
inject: ['baseUrl', 'fetchOptions', 't'],
|
||||
props: {
|
||||
field: {
|
||||
type: Object,
|
||||
@@ -952,6 +952,7 @@ export default {
|
||||
|
||||
return fetch(this.baseUrl + '/api/attachments', {
|
||||
method: 'POST',
|
||||
headers: { ...this.fetchOptions.headers },
|
||||
body: formData
|
||||
}).then(async (resp) => {
|
||||
if (resp.status === 422 || resp.status === 500) {
|
||||
|
||||
Reference in new issue
Block a user