diff --git a/client/src/components/windows/register/RegisterWindow.tsx b/client/src/components/windows/register/RegisterWindow.tsx index 4c9a120..82fede4 100644 --- a/client/src/components/windows/register/RegisterWindow.tsx +++ b/client/src/components/windows/register/RegisterWindow.tsx @@ -56,13 +56,11 @@ export function RegisterWindowControlled(props: { event.preventDefault(); auth.signup(props.state.email, props.state.password) .then(() => { - console.log("succes!") props.dispatch({ type: RegisterWindowStateActions.SetStatus, value: RegistrationStatus.Successful, }) }).catch((e: any) => { - console.log("Fail!") props.dispatch({ type: RegisterWindowStateActions.SetStatus, value: RegistrationStatus.Unsuccessful, diff --git a/client/src/components/windows/track/TrackWindow.tsx b/client/src/components/windows/track/TrackWindow.tsx index ddb330b..14a76f8 100644 --- a/client/src/components/windows/track/TrackWindow.tsx +++ b/client/src/components/windows/track/TrackWindow.tsx @@ -16,9 +16,11 @@ import EditIcon from '@material-ui/icons/Edit'; import { modifyTrack } from '../../../lib/saveChanges'; import { getTrack } from '../../../lib/backend/tracks'; +export type TrackMetadata = serverApi.TrackWithId; + export interface TrackWindowState extends WindowState { id: number, - metadata: serverApi.Track | null, + metadata: TrackMetadata | null, } export enum TrackWindowStateActions { diff --git a/client/src/setupProxy.js b/client/src/setupProxy.js index 1e39e75..7368f95 100644 --- a/client/src/setupProxy.js +++ b/client/src/setupProxy.js @@ -6,6 +6,9 @@ module.exports = function(app) { createProxyMiddleware({ target: 'http://localhost:5000', changeOrigin: true, - }) + pathRewrite: { + '^/api': '/', // remove base path + }, + }), ); }; \ No newline at end of file diff --git a/server/db/Query.ts b/server/db/Query.ts index c7ad76c..3062a9e 100644 --- a/server/db/Query.ts +++ b/server/db/Query.ts @@ -3,29 +3,29 @@ import { EndpointError, EndpointHandler, handleErrorsInEndpoint } from '../endpo import Knex from 'knex'; import asJson from '../lib/asJson'; -export function toApiTag(dbObj: any): api.Tag { - return { +export function toApiTag(dbObj: any): api.TagWithDetailsWithId { + return { mbApi_typename: "tag", - tagId: dbObj['tags.id'], + id: dbObj['tags.id'], name: dbObj['tags.name'], parentId: dbObj['tags.parentId'], parent: dbObj.parent ? toApiTag(dbObj.parent) : undefined, }; } -export function toApiArtist(dbObj: any): api.Artist { - return { +export function toApiArtist(dbObj: any): api.ArtistWithId { + return { mbApi_typename: "artist", - artistId: dbObj['artists.id'], + id: dbObj['artists.id'], name: dbObj['artists.name'], storeLinks: asJson(dbObj['artists.storeLinks']), }; } -export function toApiTrack(dbObj: any, artists: any[], tags: any[], albums: any[]): api.Track { - return { +export function toApiTrack(dbObj: any, artists: any[], tags: any[], albums: any[]): api.TrackWithDetailsWithId { + return { mbApi_typename: "track", - trackId: dbObj['tracks.id'], + id: dbObj['tracks.id'], name: dbObj['tracks.name'], storeLinks: asJson(dbObj['tracks.storeLinks']), artists: artists.map((artist: any) => { @@ -38,10 +38,10 @@ export function toApiTrack(dbObj: any, artists: any[], tags: any[], albums: any[ } } -export function toApiAlbum(dbObj: any): api.Album { - return { +export function toApiAlbum(dbObj: any): api.AlbumWithId { + return { mbApi_typename: "album", - albumId: dbObj['albums.id'], + id: dbObj['albums.id'], name: dbObj['albums.name'], storeLinks: asJson(dbObj['albums.storeLinks']), };