Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/ContactPointSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const props = defineProps<{

const { t } = useTranslation()
const { $api } = useNuxtApp()
const { isLoading, start, finish } = useLoadingIndicator()
const isLoading = ref(false)

const contactSelectRef = useTemplateRef('contactSelect')

Expand Down Expand Up @@ -232,7 +232,7 @@ async function save() {
console.error('[ContactPointSelect] Cannot save: contact already has an id, expected a new contact')
return
}
start()
isLoading.value = true
try {
const newContact = await newContactPoint($api, props.organization, contact.value)
if (contactSelectRef.value) {
Expand All @@ -241,7 +241,7 @@ async function save() {
}
}
finally {
finish()
isLoading.value = false
}
}
</script>
26 changes: 13 additions & 13 deletions components/Datasets/AdminUpdateDatasetPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<LoadingBlock
v-slot="{ data: dataset }"

Check warning on line 3 in components/Datasets/AdminUpdateDatasetPage.vue

View workflow job for this annotation

GitHub Actions / check-cdata-quality

Variable 'dataset' is already declared in the upper scope
:status
:data="dataset"
>
Expand Down Expand Up @@ -142,7 +142,7 @@
const { $api } = useNuxtApp()

const route = useRoute()
const { start, finish, isLoading } = useLoadingIndicator()
const isLoading = ref(false)

const { toast } = useToast()

Expand All @@ -167,7 +167,7 @@
if (!datasetForm.value) throw new Error('No dataset form')

try {
start()
isLoading.value = true
if (
datasetForm.value.contact_points
&& datasetForm.value.owned?.organization
Expand All @@ -189,12 +189,12 @@
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
}
finally {
finish()
isLoading.value = false
}
}

async function deleteDataset() {
start()
isLoading.value = true
try {
await $api(`/api/1/datasets/${route.params.id}`, {
method: 'DELETE',
Expand All @@ -204,13 +204,13 @@
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
}
finally {
finish()
isLoading.value = false
}
}

async function switchDatasetPrivate() {
if (!datasetForm.value) throw new Error('No dataset form')
start()
isLoading.value = true
try {
await $api(`/api/1/datasets/${dataset.value?.id}/`, {
method: 'PUT',
Expand All @@ -225,13 +225,13 @@
}
}
finally {
finish()
isLoading.value = false
}
}

async function restoreDataset() {
if (!datasetForm.value) throw new Error('No dataset form')
start()
isLoading.value = true
try {
await $api(`/api/1/datasets/${dataset.value?.id}/`, {
method: 'PUT',
Expand All @@ -241,13 +241,13 @@
toast.success(t('Jeu de données restauré !'))
}
finally {
finish()
isLoading.value = false
}
}

async function archiveDataset() {
if (!datasetForm.value) throw new Error('No dataset form')
start()
isLoading.value = true
try {
await $api(`/api/1/datasets/${dataset.value?.id}/`, {
method: 'PUT',
Expand All @@ -263,14 +263,14 @@
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
}
finally {
finish()
isLoading.value = false
}
}

async function feature() {
const method = dataset.value?.featured ? 'DELETE' : 'POST'
try {
start()
isLoading.value = true
await $api(`/api/1/datasets/${route.params.id}/featured`, {
method,
})
Expand All @@ -286,7 +286,7 @@
toast.error(t('Impossible de mettre en avant ce jeu de données'))
}
finally {
finish()
isLoading.value = false
}
}
</script>
Loading