fixed logic error
This commit is contained in:
parent
d70f98bf48
commit
e18e6a94c1
@ -18,8 +18,8 @@ export default {
|
|||||||
await this.save()
|
await this.save()
|
||||||
},
|
},
|
||||||
async save() {
|
async save() {
|
||||||
this.$engine.createQuote(this.quote.quote)
|
// this.$engine.createQuote(this.quote.quote)
|
||||||
// this.$engine.saveQuote(this.quote.id, this.quote.quote)
|
this.$engine.saveQuote(this.quote.id, this.quote.quote)
|
||||||
await this.$engine.getMyQuotes()
|
await this.$engine.getMyQuotes()
|
||||||
},
|
},
|
||||||
async remove() {
|
async remove() {
|
||||||
|
@ -11,12 +11,15 @@ func (app *Application) GetQuotes(usr *user.User, w http.ResponseWriter, r *http
|
|||||||
gameRef := r.URL.Query().Get("g")
|
gameRef := r.URL.Query().Get("g")
|
||||||
gm, err := app.GetGameById(gameRef)
|
gm, err := app.GetGameById(gameRef)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Printf("attempt to get quotes for invalid game id %s\n", gameRef)
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
fmt.Fprintf(w, "game not found")
|
fmt.Fprintf(w, "game not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if usr.GetGameId() != gameRef || !usr.IsGamemaster() {
|
if usr.GetGameId() != gameRef && !usr.IsGamemaster() {
|
||||||
|
fmt.Printf("user's game id is %s\n", usr.GetGameId())
|
||||||
|
fmt.Printf("user not allowed to access game id %s\n", gameRef)
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
fmt.Fprintf(w, "forbidden")
|
fmt.Fprintf(w, "forbidden")
|
||||||
return
|
return
|
||||||
|
@ -16,7 +16,7 @@ func (app *Application) RemoveQuote(usr *user.User, w http.ResponseWriter, r *ht
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if usr.GetGameId() != gameRef || !usr.IsGamemaster() {
|
if usr.GetGameId() != gameRef && !usr.IsGamemaster() {
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
fmt.Fprintf(w, "forbidden")
|
fmt.Fprintf(w, "forbidden")
|
||||||
return
|
return
|
||||||
|
@ -18,7 +18,7 @@ func (app *Application) SaveQuote(usr *user.User, w http.ResponseWriter, r *http
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if usr.GetGameId() != gameRef || !usr.IsGamemaster() {
|
if usr.GetGameId() != gameRef && !usr.IsGamemaster() {
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
fmt.Fprintf(w, "forbidden")
|
fmt.Fprintf(w, "forbidden")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user