eslint --fix
This commit is contained in:
@@ -99,8 +99,12 @@ axiosInstance.interceptors.response.use(
|
||||
|
||||
let _accessToken: string | null = null
|
||||
|
||||
export function _getAccessToken() { return _accessToken }
|
||||
export function _setAccessToken(token: string) { _accessToken = token }
|
||||
export function _getAccessToken() {
|
||||
return _accessToken
|
||||
}
|
||||
export function _setAccessToken(token: string) {
|
||||
_accessToken = token
|
||||
}
|
||||
export function _clearAuth() {
|
||||
_accessToken = null
|
||||
localStorage.removeItem('refreshToken')
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
url: string
|
||||
type: 'photo' | 'voice' | 'video'
|
||||
}>()
|
||||
|
||||
@@ -60,7 +60,10 @@ async function start() {
|
||||
function stop() {
|
||||
mediaRecorder.value?.stop()
|
||||
recording.value = false
|
||||
if (timer) { clearInterval(timer); timer = null }
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
@@ -71,7 +74,10 @@ function cancel() {
|
||||
}
|
||||
recording.value = false
|
||||
duration.value = 0
|
||||
if (timer) { clearInterval(timer); timer = null }
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
}
|
||||
|
||||
function formatTime(s: number) {
|
||||
|
||||
@@ -171,8 +171,6 @@ function onDragEnd(e: PointerEvent) {
|
||||
function throwCard(direction: 1 | -1) {
|
||||
if (!cardEl.value)
|
||||
return
|
||||
const target = direction === 1 ? props.profile.id : null
|
||||
|
||||
if (!prefersReducedMotion) {
|
||||
gsap.to(cardEl.value, {
|
||||
x: direction * window.innerWidth * 1.5,
|
||||
@@ -194,8 +192,12 @@ function throwCard(direction: 1 | -1) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleLike() { throwCard(1) }
|
||||
function handleDislike() { throwCard(-1) }
|
||||
function handleLike() {
|
||||
throwCard(1)
|
||||
}
|
||||
function handleDislike() {
|
||||
throwCard(-1)
|
||||
}
|
||||
|
||||
function openProfile() {
|
||||
if (isDragging)
|
||||
@@ -203,13 +205,13 @@ function openProfile() {
|
||||
router.push(`/profile/${props.profile.id}`)
|
||||
}
|
||||
|
||||
function nextImage() {
|
||||
function _nextImage() {
|
||||
if (currentImageIndex.value < (props.profile.media?.length ?? 1) - 1) {
|
||||
currentImageIndex.value++
|
||||
}
|
||||
}
|
||||
|
||||
function prevImage(e: Event) {
|
||||
function _prevImage(e: Event) {
|
||||
e.stopPropagation()
|
||||
if (currentImageIndex.value > 0)
|
||||
currentImageIndex.value--
|
||||
@@ -217,7 +219,9 @@ function prevImage(e: Event) {
|
||||
|
||||
// Touch support
|
||||
let touchStartX = 0
|
||||
function onTouchStart(e: TouchEvent) { touchStartX = e.touches[0].clientX }
|
||||
function onTouchStart(e: TouchEvent) {
|
||||
touchStartX = e.touches[0].clientX
|
||||
}
|
||||
function onTouchEnd(e: TouchEvent) {
|
||||
if (!props.isTop)
|
||||
return
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="card-stack">
|
||||
{{ feedStore.cards }}
|
||||
<div v-if="feedStore.loading && feedStore.cards.length === 0" class="card-stack__loading">
|
||||
<LoadingSpinner size="lg" />
|
||||
</div>
|
||||
@@ -47,9 +48,9 @@ const feedStore = useFeed()
|
||||
const authStore = useAuth()
|
||||
const uiStore = useUi()
|
||||
|
||||
const prefersReducedMotion = typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||
const _prefersReducedMotion = typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||
|
||||
const visibleCards = computed(() => feedStore.cards.slice(0, 3))
|
||||
const visibleCards = computed(() => feedStore.cards?.slice(0, 3) ?? [])
|
||||
|
||||
async function handleLike(profileId: string) {
|
||||
const activeProfile = authStore.activeProfile
|
||||
|
||||
@@ -97,8 +97,14 @@ const districts = ref<District[]>([])
|
||||
|
||||
watch(() => filters.cityId, async (cityId) => {
|
||||
filters.districtId = ''
|
||||
if (!cityId) { districts.value = []; return }
|
||||
if (uiStore.districts[cityId]) { districts.value = uiStore.districts[cityId]; return }
|
||||
if (!cityId) {
|
||||
districts.value = []
|
||||
return
|
||||
}
|
||||
if (uiStore.districts[cityId]) {
|
||||
districts.value = uiStore.districts[cityId]
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await apiClient.api.citiesControllerFindDistricts(cityId) as unknown as District[]
|
||||
uiStore.setDistricts(cityId, res)
|
||||
|
||||
@@ -114,7 +114,7 @@ async function onFileChange(e: Event) {
|
||||
fileInput.value.value = ''
|
||||
}
|
||||
|
||||
async function doUpload(file: File | null, tauriPath?: string) {
|
||||
async function doUpload(_file: File | null, _tauriPath?: string) {
|
||||
uploading.value = true
|
||||
try {
|
||||
// API expects multipart/form-data with the file; we pass query type=photo
|
||||
|
||||
@@ -125,8 +125,14 @@ const form = reactive({
|
||||
const districts = ref<District[]>([])
|
||||
|
||||
watch(() => form.cityId, async (cityId) => {
|
||||
if (!cityId) { districts.value = []; return }
|
||||
if (uiStore.districts[cityId]) { districts.value = uiStore.districts[cityId]; return }
|
||||
if (!cityId) {
|
||||
districts.value = []
|
||||
return
|
||||
}
|
||||
if (uiStore.districts[cityId]) {
|
||||
districts.value = uiStore.districts[cityId]
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await apiClient.api.citiesControllerFindDistricts(cityId) as unknown as District[]
|
||||
uiStore.setDistricts(cityId, res)
|
||||
|
||||
@@ -35,11 +35,13 @@ async function fetchNextPage(profileId: string) {
|
||||
page: page.value,
|
||||
limit: 20,
|
||||
...filters,
|
||||
}) as unknown as FeedProfile[]
|
||||
})
|
||||
|
||||
console.log(res.data)
|
||||
|
||||
if (page.value === 1)
|
||||
cards.value = res
|
||||
else cards.value.push(...res)
|
||||
cards.value = res.data
|
||||
else cards.value.push(...res.data)
|
||||
|
||||
hasMore.value = res.length >= 20
|
||||
page.value++
|
||||
|
||||
@@ -55,11 +55,21 @@ function setSidebarExpanded(value: boolean) {
|
||||
sidebarExpanded.value = value
|
||||
}
|
||||
|
||||
function setTags(data: Tag[]) { tags.value = data }
|
||||
function setCities(data: City[]) { cities.value = data }
|
||||
function setDistricts(cityId: string, data: District[]) { districts[cityId] = data }
|
||||
function setGreetings(data: Greeting[]) { greetings.value = data }
|
||||
function setReferencesLoaded() { referencesLoaded.value = true }
|
||||
function setTags(data: Tag[]) {
|
||||
tags.value = data
|
||||
}
|
||||
function setCities(data: City[]) {
|
||||
cities.value = data
|
||||
}
|
||||
function setDistricts(cityId: string, data: District[]) {
|
||||
districts[cityId] = data
|
||||
}
|
||||
function setGreetings(data: Greeting[]) {
|
||||
greetings.value = data
|
||||
}
|
||||
function setReferencesLoaded() {
|
||||
referencesLoaded.value = true
|
||||
}
|
||||
|
||||
export function useUi() {
|
||||
return reactive({
|
||||
|
||||
@@ -156,7 +156,9 @@ async function send(text: string, mediaUrl?: string, mediaType?: 'photo' | 'voic
|
||||
}
|
||||
}
|
||||
|
||||
function goBack() { window.history.back() }
|
||||
function goBack() {
|
||||
window.history.back()
|
||||
}
|
||||
|
||||
async function doCloseChat() {
|
||||
if (!profileId.value)
|
||||
|
||||
@@ -176,7 +176,7 @@ function formatDateTime(iso: string) {
|
||||
}
|
||||
|
||||
// Pending = first two status ids roughly; accept/decline/complete = 3+
|
||||
const pendingStatusId = computed(() => statuses.value[0]?.id ?? '')
|
||||
const _pendingStatusId = computed(() => statuses.value[0]?.id ?? '')
|
||||
const acceptedStatusId = computed(() => statuses.value[1]?.id ?? '')
|
||||
const declinedStatusId = computed(() => statuses.value[2]?.id ?? '')
|
||||
const completedStatusId = computed(() => statuses.value[3]?.id ?? '')
|
||||
|
||||
@@ -214,8 +214,14 @@ const loadingDistricts = ref(false)
|
||||
|
||||
// Load districts when city changes
|
||||
watch(() => form.cityId, async (cityId) => {
|
||||
if (!cityId) { districts.value = []; return }
|
||||
if (uiStore.districts[cityId]) { districts.value = uiStore.districts[cityId]; return }
|
||||
if (!cityId) {
|
||||
districts.value = []
|
||||
return
|
||||
}
|
||||
if (uiStore.districts[cityId]) {
|
||||
districts.value = uiStore.districts[cityId]
|
||||
return
|
||||
}
|
||||
loadingDistricts.value = true
|
||||
try {
|
||||
const res = await apiClient.api.citiesControllerFindDistricts(cityId) as unknown as District[]
|
||||
|
||||
@@ -154,7 +154,7 @@ const deleting = ref(false)
|
||||
|
||||
const profile = computed(() => authStore.activeProfile)
|
||||
|
||||
function onSaved(updated: UserProfile) {
|
||||
function onSaved(_updated: UserProfile) {
|
||||
editing.value = false
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ import { useUi } from '@/composables/useUi'
|
||||
const route = useRoute()
|
||||
const authStore = useAuth()
|
||||
const uiStore = useUi()
|
||||
const chatStore = useChat()
|
||||
const _chatStore = useChat()
|
||||
|
||||
const profileId = route.params.profileId as string
|
||||
const profile = ref<UserProfile | null>(null)
|
||||
@@ -173,7 +173,9 @@ const isOwnProfile = computed(() =>
|
||||
authStore.profiles.some(p => p.id === profileId),
|
||||
)
|
||||
|
||||
function goBack() { window.history.back() }
|
||||
function goBack() {
|
||||
window.history.back()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user