update routes

This commit is contained in:
Pete Matsyburka committed 2026-09-27 09:43:48 +03:00
1 parent 6a9b123cdc
commit f637ee907c
6 files changed
+43 -6

No files matched your search

+1 -2
View File
@@ -126,11 +126,10 @@ window.customElements.define('draw-signature', class extends HTMLElement {
const formData = new FormData()
formData.append('file', file)
formData.append('submitter_slug', this.dataset.slug)
formData.append('name', 'attachments')
formData.append('remember_signature', 'true')
return fetch('/api/attachments', {
return fetch(`/s/${this.dataset.slug}/upload`, {
method: 'POST',
body: formData
}).then(resp => resp.json())
+11 -1
View File
@@ -197,10 +197,20 @@ export default {
formData.append('submitter_slug', this.submitterSlug)
formData.append('name', 'attachments')
return fetch(this.baseUrl + '/api/attachments', {
return fetch(this.baseUrl + `/s/${this.submitterSlug}/upload`, {
method: 'POST',
headers: { ...this.fetchOptions.headers },
body: formData
}).then((resp) => {
if (resp.status === 404) {
return fetch(this.baseUrl + '/api/attachments', {
method: 'POST',
headers: { ...this.fetchOptions.headers },
body: formData
})
} else {
return resp
}
}).then(async (resp) => {
const data = await resp.json()
+8
View File
@@ -1607,6 +1607,14 @@ export default {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ v: this.viewToken })
}).then((resp) => {
if (resp.status === 404) {
return fetch(this.baseUrl + '/api/submitter_form_views', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ submitter_slug: this.submitterSlug })
})
}
})
},
previousSignatureValueFor (field) {
@@ -501,10 +501,20 @@ export default {
formData.append('name', 'attachments')
formData.append('type', 'initials')
return fetch(this.baseUrl + '/api/attachments', {
return fetch(this.baseUrl + `/s/${this.submitterSlug}/upload`, {
method: 'POST',
headers: { ...this.fetchOptions.headers },
body: formData
}).then((resp) => {
if (resp.status === 404) {
return fetch(this.baseUrl + '/api/attachments', {
method: 'POST',
headers: { ...this.fetchOptions.headers },
body: formData
})
} else {
return resp
}
}).then(async (resp) => {
if (resp.status === 422 || resp.status === 500) {
const data = await resp.json()
@@ -991,10 +991,20 @@ export default {
formData.append('remember_signature', this.rememberSignature)
formData.append('type', 'signature')
return fetch(this.baseUrl + '/api/attachments', {
return fetch(this.baseUrl + `/s/${this.submitterSlug}/upload`, {
method: 'POST',
headers: { ...this.fetchOptions.headers },
body: formData
}).then((resp) => {
if (resp.status === 404) {
return fetch(this.baseUrl + '/api/attachments', {
method: 'POST',
headers: { ...this.fetchOptions.headers },
body: formData
})
} else {
return resp
}
}).then(async (resp) => {
if (resp.status === 422 || resp.status === 500) {
const data = await resp.json()