mirror of
https://github.com/directus/directus.git
synced 2026-01-24 16:28:10 -05:00
Add server info store
This commit is contained in:
18
app/src/stores/server.ts
Normal file
18
app/src/stores/server.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { createStore } from 'pinia';
|
||||
import api from '@/api';
|
||||
|
||||
export const useServerStore = createStore({
|
||||
id: 'serverStore',
|
||||
state: () => ({
|
||||
info: null,
|
||||
}),
|
||||
actions: {
|
||||
async hydrate() {
|
||||
const response = await api.get(`/server/info`);
|
||||
this.state.info = response.data.data;
|
||||
},
|
||||
dehydrate() {
|
||||
this.reset();
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user