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