feat: add preset and edit preset.

This commit is contained in:
Wentao Lyu 2023-04-02 04:15:07 +08:00
parent 80ef5008dd
commit 45e17da241
29 changed files with 592 additions and 493 deletions

View file

@ -39,6 +39,7 @@ const App = () => {
const [user, setUser] = useRecoilState(store.user);
const setIsSearchEnabled = useSetRecoilState(store.isSearchEnabled);
const setEndpointsConfig = useSetRecoilState(store.endpointsConfig);
const setPresets = useSetRecoilState(store.presets);
useEffect(() => {
// fetch if seatch enabled
@ -70,6 +71,21 @@ const App = () => {
console.log('Not login!');
window.location.href = '/auth/login';
});
// fetch presets
axios
.get('/api/presets', {
timeout: 1000,
withCredentials: true
})
.then(({ data }) => {
setPresets(data);
})
.catch(error => {
console.error(error);
console.log('Not login!');
window.location.href = '/auth/login';
});
}, []);
if (user)