consumer模块完成90%,前端完成supabase对接

This commit is contained in:
2026-02-04 17:21:15 +08:00
parent 8a535e3f38
commit 39aa1b6bec
1335 changed files with 191376 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
import { getUserIdOrNull } from './auth.uts'
import { toLoginWithRedirect, getCurrentPageUrlWithQuery } from '@/utils/authRedirect.uts'
export type EnsureLoginOptions = {
redirectUrl?: string
toastTitle?: string
}
export function ensureAnalyticsLogin(opts?: EnsureLoginOptions): boolean {
const uid = getUserIdOrNull()
if (uid != null && uid !== '') return true
const target = (opts?.redirectUrl != null && opts?.redirectUrl?.length > 0)
? opts?.redirectUrl as string
: getCurrentPageUrlWithQuery()
uni.showToast({ title: opts?.toastTitle ?? '请先登录', icon: 'none' })
toLoginWithRedirect(target)
return false
}