sql数据流,amdin业务逻辑接入
This commit is contained in:
@@ -64,8 +64,8 @@ export async function getCurrentUser() : Promise<UserProfile | null> {
|
||||
state.userProfile = { username: '', email: '' }
|
||||
state.isLoggedIn = false // 未登录
|
||||
return null
|
||||
} // 查询 ak_users 表补全 profile
|
||||
const res = await supa.from('ak_users').select('*', {}).eq('id', userId).execute()
|
||||
} // 查询 ak_users 表补全 profile(权威关联字段:auth_id = auth.uid())
|
||||
const res = await supa.from('ak_users').select('*', {}).eq('auth_id', userId).execute()
|
||||
console.log(res)
|
||||
if (res.status >= 200 && res.status < 300 && (res.data != null)) {
|
||||
let user : UTSJSONObject | null = null;
|
||||
@@ -182,13 +182,11 @@ export function getUserStore() {
|
||||
},
|
||||
|
||||
getUserRole() : string | null {
|
||||
// Default role logic - can be enhanced based on your needs
|
||||
const sessionInfo = supa.getSession()
|
||||
if (sessionInfo.user == null) return null
|
||||
|
||||
// You can add role detection logic here
|
||||
// For now, return a default role
|
||||
return 'teacher' // or determine from user profile/database
|
||||
const profile = state.userProfile
|
||||
if (profile != null && profile.role != null) {
|
||||
return profile.role
|
||||
}
|
||||
return null
|
||||
},
|
||||
|
||||
getProfile() : UserProfile | null {
|
||||
|
||||
Reference in New Issue
Block a user