Admin: Basic node listing
This commit is contained in:
parent
c9ac65eaad
commit
0f60436b2c
11 changed files with 223 additions and 58 deletions
29
frontend/src/stores/nodes.ts
Normal file
29
frontend/src/stores/nodes.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import {defineStore} from "pinia";
|
||||
import {isEnhancedNodes, type EnhancedNode} from "@/types";
|
||||
import {internalApi} from "@/utils/Api";
|
||||
|
||||
interface NodesStoreState {
|
||||
nodes: EnhancedNode[];
|
||||
}
|
||||
|
||||
export const useNodesStore = defineStore({
|
||||
id: "nodes",
|
||||
state(): NodesStoreState {
|
||||
return {
|
||||
nodes: [],
|
||||
};
|
||||
},
|
||||
getters: {
|
||||
getNodes(state: NodesStoreState): EnhancedNode[] {
|
||||
return state.nodes;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async refresh(): Promise<void> {
|
||||
this.nodes = await internalApi.get<EnhancedNode[]>(
|
||||
"nodes",
|
||||
isEnhancedNodes
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue