Session api token validation
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import MainLayout from "@/Layouts/MainLayout.vue"
|
||||
import { Head, router } from '@inertiajs/vue3'
|
||||
import { computed, ref, watchEffect } from 'vue'
|
||||
import { Flight, ProfileView, RegionRange, User, FlightRange, FlightScope } from "@/Types/types"
|
||||
import {Head, router, usePage} from '@inertiajs/vue3'
|
||||
import {computed, ref, watch, watchEffect} from 'vue'
|
||||
import {Flight, ProfileView, RegionRange, User, FlightRange, FlightScope, SharedProps} from "@/Types/types"
|
||||
import { useFlightStats } from "@/Composables/useFlightStats"
|
||||
import ProfileViewSwitcher from "@/Components/FlightsGoneBy/ProfileViewSwitcher.vue"
|
||||
import ProfileLayout from "@/Components/FlightsGoneBy/ProfileLayout.vue"
|
||||
@@ -11,9 +11,13 @@ import BoardingPasses from "@/Components/FlightsGoneBy/BoardingPasses.vue"
|
||||
import FlightMapAndCharts from "@/Components/FlightsGoneBy/FlightMapAndCharts.vue"
|
||||
import FlightFilter from "@/Components/FlightsGoneBy/FlightFilter.vue"
|
||||
import { useFlights } from "@/Composables/useFlights"
|
||||
import {useUpdateSetting} from "@/Composables/useUpdateSetting";
|
||||
|
||||
defineOptions({ layout: MainLayout })
|
||||
|
||||
const {updateSetting} = useUpdateSetting()
|
||||
const page = usePage<SharedProps>().props
|
||||
|
||||
const props = defineProps<{
|
||||
user: User
|
||||
canEdit: boolean
|
||||
@@ -24,6 +28,13 @@ const props = defineProps<{
|
||||
flightCount: number
|
||||
}>()
|
||||
|
||||
const hideFilters = ref(page.auth?.user?.resolved_settings?.hide_map_filters ?? false)
|
||||
|
||||
watch(hideFilters, (value) => {
|
||||
updateSetting('hide_map_filters', value).catch(() => {})
|
||||
})
|
||||
|
||||
|
||||
// ── Flights state ─────────────────────────────────────────────────────────────
|
||||
|
||||
const { flights, flightsLoading } = useFlights(`/internal/user/${props.user.name}/flights`)
|
||||
@@ -31,8 +42,6 @@ const localSelectedFlightId = ref(props.selectedFlightId ?? null)
|
||||
|
||||
// ── Filter state ──────────────────────────────────────────────────────────────
|
||||
|
||||
const filtersOpen = ref(window.innerWidth >= 1024)
|
||||
|
||||
const selectedYears = ref<number[]>([])
|
||||
const selectedAirlines = ref<number[]>([])
|
||||
const selectedAlliances = ref<number[]>([])
|
||||
@@ -162,7 +171,7 @@ const routeNames: Record<Exclude<ProfileView, 'achievements'>, string> = {
|
||||
} as const
|
||||
|
||||
function toggleFilters(e: MouseEvent) {
|
||||
filtersOpen.value = !filtersOpen.value
|
||||
hideFilters.value = !hideFilters.value
|
||||
;(e.currentTarget as HTMLButtonElement).blur()
|
||||
}
|
||||
|
||||
@@ -193,7 +202,7 @@ function switchView(view: ProfileView) {
|
||||
<ProfileViewSwitcher :user="user" :active-view="activeView" @update:active-view="switchView" />
|
||||
<button
|
||||
class="filter-toggle"
|
||||
:class="{ active: filtersOpen || activeFilterCount > 0 }"
|
||||
:class="{ active: !hideFilters || activeFilterCount > 0 }"
|
||||
@click="toggleFilters"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
@@ -204,7 +213,7 @@ function switchView(view: ProfileView) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-show="filtersOpen" class="filter-panel">
|
||||
<div v-show="!hideFilters" class="filter-panel">
|
||||
<FlightFilter :flights="flights" @change="onFiltersChange" />
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user