mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-17 13:31:52 +00:00
0.0.9
- Fix mobile menu auto collapse on select - Add /u/ route for public user profiles (Added private flag to db - to implement later) - Add /user route for your own profile / edit profile - Added handling for if API is offline/incorrect - Add index.html loading spinner while react bundle downloads - Change HashRouter to BrowserRouter - Added sources column to scrobbles
This commit is contained in:
parent
af02bd99cc
commit
e570314ac2
27 changed files with 435 additions and 89 deletions
|
@ -14,8 +14,6 @@ function getHeaders() {
|
|||
}
|
||||
|
||||
export const PostLogin = (formValues) => {
|
||||
// const { setLoading, setUser } = useContext(AuthContext);
|
||||
// setLoading(true)
|
||||
return axios.post(process.env.REACT_APP_API_URL + "login", formValues)
|
||||
.then((response) => {
|
||||
if (response.data.token) {
|
||||
|
@ -36,6 +34,7 @@ export const PostLogin = (formValues) => {
|
|||
}
|
||||
})
|
||||
.catch(() => {
|
||||
toast.error('Failed to connect');
|
||||
return Promise.resolve();
|
||||
});
|
||||
};
|
||||
|
@ -54,6 +53,7 @@ export const PostRegister = (formValues) => {
|
|||
}
|
||||
})
|
||||
.catch(() => {
|
||||
toast.error('Failed to connect');
|
||||
return Promise.resolve();
|
||||
});
|
||||
};
|
||||
|
@ -61,16 +61,21 @@ export const PostRegister = (formValues) => {
|
|||
export const getStats = () => {
|
||||
return axios.get(process.env.REACT_APP_API_URL + "stats").then(
|
||||
(data) => {
|
||||
data.isLoading = false;
|
||||
return data.data;
|
||||
}
|
||||
);
|
||||
).catch(() => {
|
||||
toast.error('Failed to connect');
|
||||
return {};
|
||||
});
|
||||
};
|
||||
|
||||
export const getRecentScrobbles = (id) => {
|
||||
return axios.get(process.env.REACT_APP_API_URL + "user/" + id + "/scrobbles", { headers: getHeaders() })
|
||||
.then((data) => {
|
||||
return data.data;
|
||||
}).catch(() => {
|
||||
toast.error('Failed to connect');
|
||||
return {};
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -78,6 +83,9 @@ export const getConfigs = () => {
|
|||
return axios.get(process.env.REACT_APP_API_URL + "config", { headers: getHeaders() })
|
||||
.then((data) => {
|
||||
return data.data;
|
||||
}).catch(() => {
|
||||
toast.error('Failed to connect');
|
||||
return {};
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -101,3 +109,22 @@ export const postConfigs = (values, toggle) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const getProfile = (userName) => {
|
||||
return axios.get(process.env.REACT_APP_API_URL + "profile/" + userName, { headers: getHeaders() })
|
||||
.then((data) => {
|
||||
return data.data;
|
||||
}).catch(() => {
|
||||
toast.error('Failed to connect');
|
||||
return {};
|
||||
});
|
||||
};
|
||||
|
||||
export const getUser = () => {
|
||||
return axios.get(process.env.REACT_APP_API_URL + "user", { headers: getHeaders() })
|
||||
.then((data) => {
|
||||
return data.data;
|
||||
}).catch(() => {
|
||||
toast.error('Failed to connect');
|
||||
return {};
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue