refactor(store): replace project and skill models with generated models
Some checks failed
CI / build-and-test (push) Failing after -31m25s
Some checks failed
CI / build-and-test (push) Failing after -31m25s
* Update project creation and retrieval to use generated models * Modify skill addition and listing to utilize generated models * Refactor thought handling to incorporate generated models * Adjust tool annotations to align with new model structure * Update API calls in the UI to use new ResolveSpec-based endpoints * Enhance stats retrieval logic to aggregate thought metadata
This commit is contained in:
@@ -26,10 +26,18 @@
|
||||
|
||||
GlobalStateStore.setState({
|
||||
onFetchSession: async (state) => {
|
||||
const token = state.session.authToken;
|
||||
if (!token) return null;
|
||||
const res = await fetch('/api/admin/stats', {
|
||||
headers: { Authorization: `Bearer ${token}` }
|
||||
const token = state.session?.authToken;
|
||||
if (!token) return {};
|
||||
const res = await fetch('/api/rs/public/projects', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
operation: 'read',
|
||||
options: { limit: 1 }
|
||||
})
|
||||
});
|
||||
if (!res.ok) return { session: { loggedIn: false } };
|
||||
return { session: { loggedIn: true, authToken: token } };
|
||||
@@ -47,14 +55,7 @@
|
||||
|
||||
try {
|
||||
const token = await loginWithCredentials(username, password);
|
||||
const state = GlobalStateStore.getState();
|
||||
state.setSession({
|
||||
authToken: token,
|
||||
loggedIn: true,
|
||||
validated: true,
|
||||
expiryDate: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString()
|
||||
});
|
||||
state.setUser({ username });
|
||||
await GlobalStateStore.getState().login(token, { username });
|
||||
authMessage = 'Login successful.';
|
||||
await loadStatus();
|
||||
} catch (err) {
|
||||
@@ -128,7 +129,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLoggedIn.current) {
|
||||
await GlobalStateStore.getState().fetchData();
|
||||
|
||||
if (GlobalStateStore.getState().isLoggedIn()) {
|
||||
await loadStatus();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user