diff --git a/frontend/Makefile b/frontend/Makefile index 4f4062f..116f10f 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -17,7 +17,7 @@ watch: node_modules .PHONY: build build: node_modules dist/minified @echo Building with parcel - ./node_modules/.bin/parcel build + ./node_modules/.bin/parcel build src/index.html @echo Minifying $(foreach file, $(wildcard dist/*.js), $(call minify, $(file))) diff --git a/frontend/src/components/app.tsx b/frontend/src/components/app.tsx index 16498fa..a74f739 100644 --- a/frontend/src/components/app.tsx +++ b/frontend/src/components/app.tsx @@ -40,6 +40,7 @@ export default class Application extends React.Component { // TODO: When asking the server if our session is still valid, a spinner // should be shown if (getSessionToken(window) !== null) { + // TODO: We still need to fetch the user data this.props.setAuthenticated(true); } } @@ -143,7 +144,7 @@ export default class Application extends React.Component { getTopTenLearners = (): Promise => { const id = this.props.user.classId; return new Promise((res, rej) => { - fetch(`${BACKEND_URL}/auth/class/${id}/topTen`, { + fetch(`${BACKEND_URL}/api/class/${id}/topTen`, { headers: new Headers({ "Content-Type": "application/json", "Token": this.props.user.sessionToken, @@ -162,7 +163,7 @@ export default class Application extends React.Component { getNextLevel = (): Promise => { return new Promise((res, rej) => { - fetch(`${BACKEND_URL}/auth/user/nextLevel`, { + fetch(`${BACKEND_URL}/api/user/nextLevel`, { headers: new Headers({ "Content-Type": "application/json", "Token": this.props.user.sessionToken, @@ -181,7 +182,7 @@ export default class Application extends React.Component { getLevelVocab = (id: number): Promise => { return new Promise((res, rej) => { - fetch(`${BACKEND_URL}/auth/level/${id}/vocab`, { + fetch(`${BACKEND_URL}/api/level/${id}/vocab`, { method: "GET", headers: new Headers({ "Content-Type": "application/json", @@ -201,7 +202,7 @@ export default class Application extends React.Component { login = (username: string, password: string): Promise => { return new Promise((res, rej) => { - fetch(`${BACKEND_URL}/login`, { + fetch(`${BACKEND_URL}/api/login`, { method: "POST", headers: new Headers({ "Content-Type": "application/json",