At least it builds and runs again, now getting request errors.

editsong
Sander Vocke 4 years ago
parent c19fcbf9d6
commit 0758ae2564
  1. 2
      client/src/components/windows/register/RegisterWindow.tsx
  2. 4
      client/src/components/windows/track/TrackWindow.tsx
  3. 5
      client/src/setupProxy.js
  4. 24
      server/db/Query.ts

@ -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,

@ -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 {

@ -6,6 +6,9 @@ module.exports = function(app) {
createProxyMiddleware({
target: 'http://localhost:5000',
changeOrigin: true,
})
pathRewrite: {
'^/api': '/', // remove base path
},
}),
);
};

@ -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 <api.Tag>{
export function toApiTag(dbObj: any): api.TagWithDetailsWithId {
return <api.TagWithDetailsWithId>{
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 <api.Artist>{
export function toApiArtist(dbObj: any): api.ArtistWithId {
return <api.ArtistWithId>{
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 <api.Track>{
export function toApiTrack(dbObj: any, artists: any[], tags: any[], albums: any[]): api.TrackWithDetailsWithId {
return <api.TrackWithDetailsWithId>{
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 <api.Album>{
export function toApiAlbum(dbObj: any): api.AlbumWithId {
return <api.AlbumWithId>{
mbApi_typename: "album",
albumId: dbObj['albums.id'],
id: dbObj['albums.id'],
name: dbObj['albums.name'],
storeLinks: asJson(dbObj['albums.storeLinks']),
};

Loading…
Cancel
Save