mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
fix: defaults recipe actions to sort by name, ascending (#1650)
This commit is contained in:
parent
1488b75b65
commit
86d25691d2
@ -7,7 +7,7 @@ type BoundT = {
|
||||
};
|
||||
|
||||
interface StoreActions<T extends BoundT> {
|
||||
getAll(): Ref<T[] | null>;
|
||||
getAll(page?: number, perPage?: number, params?: any): Ref<T[] | null>;
|
||||
refresh(): Promise<void>;
|
||||
createOne(createData: T): Promise<void>;
|
||||
updateOne(updateData: T): Promise<void>;
|
||||
@ -25,10 +25,13 @@ export function useStoreActions<T extends BoundT>(
|
||||
allRef: Ref<T[] | null> | null,
|
||||
loading: Ref<boolean>
|
||||
): StoreActions<T> {
|
||||
function getAll() {
|
||||
function getAll(page = 1, perPage = -1, params = {} as any) {
|
||||
params.orderBy ??= "name";
|
||||
params.orderDirection ??= "asc";
|
||||
|
||||
loading.value = true;
|
||||
const allItems = useAsync(async () => {
|
||||
const { data } = await api.getAll();
|
||||
const { data } = await api.getAll(page, perPage, params);
|
||||
|
||||
if (data && allRef) {
|
||||
allRef.value = data.items;
|
||||
|
Loading…
x
Reference in New Issue
Block a user