Need game id (?) for updating game object #104

Closed
OllieBuilds opened this Issue Apr 6, 2016 · 0 comments

Comments

Projects
None yet
4 participants
@OllieBuilds

OllieBuilds commented Apr 6, 2016

const updateGame = (success, failure, data) => {
  console.log('update game call');
  $.ajax({
    method: 'PATCH',
    url: app.api + 'games/' +** app.game.id,**
    data,
  }).done(success)
  .fail(failure);
  console.log('Game updated');
};

I can't seem to get the URL correct for updating (PATCH) game status

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

app.game.id <-- ** was just to highlight

@gaand

This comment has been minimized.

gaand commented Apr 6, 2016

Yes. Also, an authorization header.

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

help

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

So, Phil and I have tried creating a JSON object with variables to incorporate the value and index, but to no avail...

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

400 errors in surplus

@RDegnen

This comment has been minimized.

RDegnen commented Apr 6, 2016

post the whole error

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

PATCH http://tic-tac-toe.wdibos.com/games/4842 400 (Bad Request) ui.js:18 Object {readyState: 4, responseText: "", status: 400, statusText: "Bad Request"}abort: ( statusText )always: ()complete: ()done: ()error: ()fail: ()getAllResponseHeaders: ()getResponseHeader: ( key )overrideMimeType: ( type )pipe: ( /* fnDone, fnFail, fnProgress */ )progress: ()promise: ( obj )readyState: 4responseText: ""setRequestHeader: ( name, value )state: ()status: 400statusCode: ( map )statusText: "Bad Request"success: ()then: ( /* fnDone, fnFail, fnProgress */ )__proto__: Objectfailure @ ui.js:18fire @ jquery.js:3187self.fireWith @ jquery.js:3317done @ jquery.js:8787(anonymous function) @ jquery.js:9151

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

uhhhh.... how do I post 'Console' with backticks?

@RDegnen

This comment has been minimized.

RDegnen commented Apr 6, 2016

did you send an authorization header as antony suggested?

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

yes:

const updateGame = (success, failure) => {
  console.log('update game call');
  $.ajax({
    method: 'PATCH',
    url: app.api + 'games/' + gameplay.gameId,
    processData: false,
    data: {
        "game": {
          "cell": {
            "index": gameplay.indexForAjax,
            "value": gameplay.valueForAjax,
          },
          "over": false
        }
      },
    headers:{
      Authorization: "Token token=" + app.user1.token,
    },
  }).done(success)
  .fail(failure);
  console.log('Game updated');
};
@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 6, 2016

the variables with suffix forAjax are defined in other sheets that ARE required in this file. Similar to previous issues, I don't know how to access the proper object property...

@RDegnen RDegnen assigned RDegnen and unassigned RDegnen Apr 6, 2016

@laurenfazah

This comment has been minimized.

laurenfazah commented Apr 6, 2016

@OllieBuilds @RDegnen is this fixed? Looks like you assigned and unassigned, but let me know if I can help.

@RDegnen

This comment has been minimized.

RDegnen commented Apr 7, 2016

@laurenfazah I directed him on the right path, the issue should probably be closed.
EDIT: still some struggling going on

@laurenfazah

This comment has been minimized.

laurenfazah commented Apr 7, 2016

@OllieBuilds can you summarize the issue as it is now?

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 7, 2016

...I can not.

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 7, 2016

Leave open... will update in AM

@laurenfazah

This comment has been minimized.

laurenfazah commented Apr 7, 2016

Has it gotten worse from this last description? If so, could you roll back to a previous commit?

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 7, 2016

Did not roll back... but I did undo some changes.

I wish I could describe my issue better... I just committed, and now I am going to throw some shit at the wall to see what sticks.

I'll be more articulate after.

@laurenfazah

This comment has been minimized.

laurenfazah commented Apr 7, 2016

Ok. I'll be watching the issue tracker for a couple more hours if you decide to revisit tonight.

@OllieBuilds

This comment has been minimized.

OllieBuilds commented Apr 7, 2016

once again... Lauren rules

@OllieBuilds OllieBuilds closed this Apr 7, 2016

MicFin added a commit that referenced this issue Jun 21, 2018

Update schedule order
game-project schedule.md move Auth to after Game UI

Close #104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment