mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 09:23:17 +01:00
feat: adds save preferences on collections
This commit is contained in:
parent
be4fc2d9ad
commit
fc2931855e
@ -1,5 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { savePreferences } from 'providers/ReduxStore/slices/app';
|
||||
import {
|
||||
IconSearch,
|
||||
IconFolders,
|
||||
@ -22,6 +23,8 @@ const CollectionsBadge = () => {
|
||||
const dispatch = useDispatch();
|
||||
const { collections } = useSelector((state) => state.collections);
|
||||
const { collectionSortOrder } = useSelector((state) => state.collections);
|
||||
const preferences = useSelector((state) => state.app.preferences);
|
||||
|
||||
const sortCollectionOrder = () => {
|
||||
let order;
|
||||
switch (collectionSortOrder) {
|
||||
@ -36,6 +39,10 @@ const CollectionsBadge = () => {
|
||||
break;
|
||||
}
|
||||
dispatch(sortCollections({ order }));
|
||||
dispatch(savePreferences({
|
||||
...preferences,
|
||||
collectionSortOrder: order
|
||||
}));
|
||||
};
|
||||
return (
|
||||
<div className="items-center mt-2 relative">
|
||||
|
Loading…
Reference in New Issue
Block a user