feat: ship agent-first mission control v0.2.57
This commit is contained in:
@@ -35,6 +35,7 @@ export const useAuthStore = defineStore('auth', {
|
||||
}),
|
||||
getters: {
|
||||
isAuthenticated: state => Boolean(state.accessToken && state.user),
|
||||
isOwner: state => state.user?.role.toLowerCase() === 'owner',
|
||||
isRateLimited: state => state.remainingAttempts === 0 && state.retryAfterSeconds > 0,
|
||||
/** Returns true if the current web-ui user is Iris (JWT user identity matches "iris"). */
|
||||
isIris: state => {
|
||||
@@ -65,7 +66,12 @@ export const useAuthStore = defineStore('auth', {
|
||||
this.retryAfterSeconds = 0
|
||||
},
|
||||
async initialize() {
|
||||
if (this.initialized) return this.isAuthenticated
|
||||
// Router guards can overlap during the initial navigation. Reuse the
|
||||
// active refresh instead of treating the not-yet-applied session as an
|
||||
// unauthenticated result.
|
||||
if (this.initialized) {
|
||||
return refreshInFlight ?? this.isAuthenticated
|
||||
}
|
||||
this.initialized = true
|
||||
return this.refresh()
|
||||
},
|
||||
@@ -110,7 +116,11 @@ export const useAuthStore = defineStore('auth', {
|
||||
} else if (response.status === 401) {
|
||||
this.remainingAttempts = remaining
|
||||
this.retryAfterSeconds = retryAfter
|
||||
throw new LoginError(body.message as string || 'Invalid email or password.', remaining, retryAfter)
|
||||
throw new LoginError(
|
||||
body.message as string || 'Invalid email or password.',
|
||||
remaining ?? 4,
|
||||
retryAfter,
|
||||
)
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof LoginError) throw error
|
||||
|
||||
Reference in New Issue
Block a user