auth init

This commit is contained in:
ntr committed 2022-08-08 19:51:17 +10:00
1 parent faa2e70e08
commit 413aeedadf
29 files changed
+2854 -649

No files matched your search

+16 -8
View File
@@ -1,17 +1,25 @@
import axios from 'axios';
const actions = store => ({
const API_URL = 'http://localhost:41337';
axios.defaults.withCredentials = true;
axios.defaults.crossDomain = true;
const actions = {
getBundles: async () => {
const { data: bundles } = await axios.get('http://localhost:41337/bundles');
return { bundles };
const { data: bundles } = await axios.get(`${API_URL}/bundles`);
return bundles;
},
getUserOffers: async (state, userId) => {
store.setState({ offers: [] });
const { data: offers } = await axios.get(`http://localhost:41337/user/${userId}/offers`);
console.log(userId, offers);
return { offers };
const { data: offers } = await axios.get(`${API_URL}/user/${userId}/offers`);
return offers;
},
});
getOffers: async (userId) => {
const { data } = await axios.get(`${API_URL}/user/${userId}/offers`);
return data;
},
};
export default actions;