Refactor code: Initialize variables with const and remove unused variables
This commit is contained in:
parent
81d77fc101
commit
f7d8cc102a
@ -28,12 +28,12 @@ const years = ref<Item[]>([])
|
|||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
years.value.push({ id: year - i, name: year - i })
|
years.value.push({ id: year - i, name: year - i })
|
||||||
}
|
}
|
||||||
let itemsUid = ref<Item[]>([])
|
const itemsUid = ref<Item[]>([])
|
||||||
let itemsUp3 = ref<Item[]>([])
|
const itemsUp3 = ref<Item[]>([])
|
||||||
let itemsPosko = ref<Item[]>([])
|
const itemsPosko = ref<Item[]>([])
|
||||||
let itemsUlp = ref<Item[]>([])
|
const itemsUlp = ref<Item[]>([])
|
||||||
let itemsRegional = ref<Item[]>([])
|
const itemsRegional = ref<Item[]>([])
|
||||||
let itemsMedia = ref<Item[]>([])
|
const itemsMedia = ref<Item[]>([])
|
||||||
// Fetch data from the API using Axios
|
// Fetch data from the API using Axios
|
||||||
const fetchMedia = () => {
|
const fetchMedia = () => {
|
||||||
itemsMedia.value = [
|
itemsMedia.value = [
|
||||||
@ -76,7 +76,7 @@ const fetchUid = async () => {
|
|||||||
itemsUid.value = res.data.map((item: any) => (
|
itemsUid.value = res.data.map((item: any) => (
|
||||||
{
|
{
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.nama.toUpperCase(),
|
name: item.nama,
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -147,18 +147,17 @@ const fetchRegional = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const selectedUid = (value: any) => {
|
const selectedUid = (value: any) => {
|
||||||
useRegionStore().setData(value.id)
|
|
||||||
fetchDataUp3(value.id)
|
fetchDataUp3(value.id)
|
||||||
}
|
}
|
||||||
const selectedUp3Posko = (value: any) => {
|
const selectedUp3Posko = (value: any) => {
|
||||||
if (value.id != 0) {
|
if (value.id != 0) {
|
||||||
useUp3Store().setData(value.id)
|
|
||||||
fetchDataPosko(value.id)
|
fetchDataPosko(value.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const selectedUp3Ulp = (value: any) => {
|
const selectedUp3Ulp = (value: any) => {
|
||||||
useUp3Store().setData(value.id)
|
if (value.id != 0) {
|
||||||
fetchDataUlp(value.id)
|
fetchDataUlp(value.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const selectedPosko = (value: any) => {
|
const selectedPosko = (value: any) => {
|
||||||
usePostsStore().setData(value.id)
|
usePostsStore().setData(value.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user