mirror of
https://github.com/web3privacy/explorer-app.git
synced 2024-10-15 16:46:26 +02:00
fix: project data save
This commit is contained in:
parent
a41e784a14
commit
da6b17b194
3 changed files with 15 additions and 6 deletions
|
@ -30,14 +30,16 @@ export const useProject = defineStore('project', () => {
|
||||||
async function publishProject() {
|
async function publishProject() {
|
||||||
isPublishing.value = true
|
isPublishing.value = true
|
||||||
try {
|
try {
|
||||||
const imageArrayBuffer = await projectImage.value?.arrayBuffer()
|
|
||||||
let imageBuffer: Buffer | undefined
|
let imageBuffer: Buffer | undefined
|
||||||
let base64Image: string | undefined
|
let base64Image: string | undefined
|
||||||
|
|
||||||
if (imageArrayBuffer) {
|
if (projectImage.value) {
|
||||||
imageBuffer = Buffer.from(imageArrayBuffer)
|
const imageArrayBuffer = await projectImage.value?.arrayBuffer()
|
||||||
const base64String = imageBuffer.toString('base64')
|
if (imageArrayBuffer) {
|
||||||
base64Image = base64String
|
imageBuffer = Buffer.from(imageArrayBuffer)
|
||||||
|
const base64String = imageBuffer.toString('base64')
|
||||||
|
base64Image = base64String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await $fetch(`/api/data`, {
|
await $fetch(`/api/data`, {
|
||||||
|
|
|
@ -98,6 +98,7 @@ name.value = project.value?.name || 'Untitled'
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
saveProject({
|
saveProject({
|
||||||
|
...project.value,
|
||||||
name: name.value,
|
name: name.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -123,11 +124,14 @@ async function publish() {
|
||||||
if (selectedTab.value === 'basic_info') {
|
if (selectedTab.value === 'basic_info') {
|
||||||
if (!currentComponent.value.isFormValid())
|
if (!currentComponent.value.isFormValid())
|
||||||
return
|
return
|
||||||
|
else save()
|
||||||
}
|
}
|
||||||
else if (isPublishing) {
|
else if (isPublishing) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentComponent.value.save()
|
||||||
|
|
||||||
await publishProject()
|
await publishProject()
|
||||||
navigateTo(`/project/${project.value?.id || project.value?.name?.toLowerCase().replace(/\s+/g, '-')}`)
|
navigateTo(`/project/${project.value?.id || project.value?.name?.toLowerCase().replace(/\s+/g, '-')}`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,13 +107,16 @@ async function publish() {
|
||||||
if (selectedTab.value === 'basic_info') {
|
if (selectedTab.value === 'basic_info') {
|
||||||
if (!currentComponent.value.isFormValid())
|
if (!currentComponent.value.isFormValid())
|
||||||
return
|
return
|
||||||
|
else save()
|
||||||
}
|
}
|
||||||
else if (isPublishing) {
|
else if (isPublishing) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentComponent.value?.save()
|
||||||
|
|
||||||
await publishProject()
|
await publishProject()
|
||||||
navigateTo(`/project/${project.value?.id || project.value?.name?.toLowerCase().replace(/\s+/g, '-')}`)
|
navigateTo('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
function jumpTo(tab: string) {
|
function jumpTo(tab: string) {
|
||||||
|
|
Loading…
Reference in a new issue