forked from mirrors/homebox
refactor: repositories (#28)
* cleanup unnecessary mocks * refactor document storage location * remove unused function * move ownership to document types to repo package * move types and mappers to repo package * refactor sets to own package
This commit is contained in:
parent
2e82398e5c
commit
343290a55a
79 changed files with 3169 additions and 3160 deletions
|
@ -1,9 +1,9 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { LocationCount } from "~~/lib/api/types/data-contracts";
|
||||
import { LocationOutCount } from "~~/lib/api/types/data-contracts";
|
||||
|
||||
export const useLocationStore = defineStore("locations", {
|
||||
state: () => ({
|
||||
allLocations: null as LocationCount[] | null,
|
||||
allLocations: null as LocationOutCount[] | null,
|
||||
client: useUserApi(),
|
||||
}),
|
||||
getters: {
|
||||
|
@ -12,7 +12,7 @@ export const useLocationStore = defineStore("locations", {
|
|||
* synched with the server by intercepting the API calls and updating on the
|
||||
* response
|
||||
*/
|
||||
locations(state): LocationCount[] {
|
||||
locations(state): LocationOutCount[] {
|
||||
if (state.allLocations === null) {
|
||||
Promise.resolve(this.refresh());
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ export const useLocationStore = defineStore("locations", {
|
|||
},
|
||||
},
|
||||
actions: {
|
||||
async refresh(): Promise<LocationCount[]> {
|
||||
async refresh(): Promise<LocationOutCount[]> {
|
||||
const result = await this.client.locations.getAll();
|
||||
if (result.error) {
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue