Blankscreen-exe / jevils-dilemma

https://jevils-dilemma.vercel.app
0 stars 3 forks source link

Setup Redux to hold player records #17

Open Blankscreen-exe opened 6 months ago

Blankscreen-exe commented 6 months ago

I want you to setup redux-toolkit boilerplate with persistor and thunk.

Currently I want to create a single Slice which contains the following state:

Note: the number of player-unique-hash-id's found inside playerRecords can vary. but the usual limit is x>=1. As for the limit of objects inside player-unique-hash-id's array, is 0<x<10.

{
    sessionId: "some-random-string",
    playerRecords: {
        "player-1s-unique-hash-id": [
            {
                question: "some random question 1",
                response: "players response to question 1"
            },
            {
                question: "some random question 2",
                response: "players response to question 2"
            },
            {
                question: "some random question 3",
                response: "players response to question 3"
            },
            {
                question: "some random question 4",
                response: "players response to question 4"
            }
        ] ,
        "player-2s-unique-hash-id": [
            {
                question: "some random question 1",
                response: "players response to question 1"
            },
            {
                question: "some random question 2",
                response: "players response to question 2"
            },
            {
                question: "some random question 3",
                response: "players response to question 3"
            },
            {
                question: "some random question 4",
                response: "players response to question 4"
            }
        ] ,

         ...

    }
}

Actions for this state will be the following:

Make sure the exported action functions have Actions at the end of their names. For examples addPlayerAction() or addPlayerResponseAction()

Note: for a sample redux setup you can see my other project: https://github.com/Blankscreen-exe/porfolio-website/tree/main/src/redux