Almost complete org/permission handling. Much cleanup, bootstrap works.

This commit is contained in:
2025-08-08 01:58:12 +00:00
parent 2505f96dde
commit 7e45bba612
12 changed files with 225 additions and 341 deletions
+6 -17
View File
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
import { registerUser, authenticateUser, registerWithToken } from '@/utils/passkey'
import { register, authenticate } from '@/utils/passkey'
export const useAuthStore = defineStore('auth', {
state: () => ({
@@ -8,7 +8,7 @@ export const useAuthStore = defineStore('auth', {
isLoading: false,
// UI State
currentView: 'login', // 'login', 'register', 'profile', 'reset'
currentView: 'login', // 'login', 'profile', 'device-link', 'reset'
status: {
message: '',
type: 'info',
@@ -39,23 +39,12 @@ export const useAuthStore = defineStore('auth', {
}
return result
},
async register(user_name) {
async register() {
this.isLoading = true
try {
const result = await registerUser(user_name)
this.userInfo = {
user: {
user_id: result.user_id,
user_name: user_name,
},
credentials: [],
aaguid_info: {},
session_type: null,
authenticated: false
}
const result = await register()
await this.setSessionCookie(result.session_token)
await this.loadUserInfo()
return result
} finally {
this.isLoading = false
@@ -64,7 +53,7 @@ export const useAuthStore = defineStore('auth', {
async authenticate() {
this.isLoading = true
try {
const result = await authenticateUser()
const result = await authenticate()
await this.setSessionCookie(result.session_token)
await this.loadUserInfo()