- Tidy init/goscrobble.service
- Add routers for Artist/Album/Track endpoints + basic pages
- Move UUID generation into Go so we don't have to query the record!! Wooo!
This commit is contained in:
Daniel Mason 2021-04-04 21:54:53 +12:00
parent 1c865a6784
commit 99f9e7cfb3
Signed by: idanoo
GPG key ID: 387387CDBC02F132
28 changed files with 388 additions and 214 deletions

View file

@ -11,6 +11,9 @@ function getHeaders() {
if (user.exp < unixtime) {
// TODO: Handle expiry nicer
toast.warning("Session expired. Please log in again")
// localStorage.removeItem('user');
// window.location.reload();
return {};
}
return { Authorization: 'Bearer ' + user.jwt };
@ -252,3 +255,30 @@ export const getServerInfo = () => {
return handleErrorResp(error)
});
}
export const getArtist = (uuid) => {
return axios.get(process.env.REACT_APP_API_URL + "artist/" + uuid).then(
(data) => {
return data.data;
}).catch((error) => {
return handleErrorResp(error)
});
};
export const getAlbum = (uuid) => {
return axios.get(process.env.REACT_APP_API_URL + "album/" + uuid).then(
(data) => {
return data.data;
}).catch((error) => {
return handleErrorResp(error)
});
};
export const getTrack = (uuid) => {
return axios.get(process.env.REACT_APP_API_URL + "track/" + uuid).then(
(data) => {
return data.data;
}).catch((error) => {
return handleErrorResp(error)
});
};