Skip to content

Sample State

Derek W edited this page Jul 31, 2019 · 1 revision

Sample State


Condensed Sample State:

{
    entities: {
        comments: {
        }
        tags: {
        }
        tracks: {
        }
        users: {
        }
    }
    session: {
        currentUser: {
        }
        currentSong: {
        }
    }
    errors: { 
    }
}

###Expanded Sample State:

{
    entities: {

        tracks: {
            23: {
                id:  23,
                title: "Example Track 23",
                audioUrl: "",
                trackLength: 2587,
                artwork_url: "example/url/23",
                createdAt: Date_object_example_23,
                userId: 9,
                tagIds: [1, 3, 25],
                favoriteCount: 12,
                comments: [1, 2]
                ...
            }

            25: {
                id: 25,
                title: "Example Track 25",
                audioUrl: "",
                trackLength: 3285,
                artwork_url: "example/url/25",
                created_at: Date_object_example_23,
                userId: 12,
                tagIds: [3, 7, 11],
                favoriteCount: 31,
                comments: [3, 4]
                ...
            }
            ...

        }

        users: {
            9: {
                id: 9,
                displayName: "sample name 9",
                profilePicUrl: "example/profile/9",
                location: "city, country",
                following: [12, ...],
                followerCount: 23
                ...
            }

            12: {
                id: 12,
                displayName: "sample name 12",
                profilePicUrl: "example/profile/12",
                location: "city, country",
                following: [9, ...],
                followerCount: 14
                ...
            }
            ...
        }

        tags: {
            1: { id: 1, tag: "tag1" },
            3: { id: 3, tag: "tag3" }
            ...
        }

        comments: {
            1: {
                id: 1,
                trackId: 23,
                userId: 12,
                parentCommentId: null,
                body: "sample comment 1",
                createdAt: Date_object_comment_example,
            }
            ...
        }
    }

    errors: {
        login: ["Username does not exist", "Incorrect password"],
        signup: ["This email address is already in use, please login.", "This username is already taken"],
        trackUploadForm: ["Please enter a title below.", "The file you've chosen is under 12MB - this indicates it may be short and, therefore, a single track and could be removed from Mixcloud."]
        ...
    }

    session: { 
        currentUser: 12
        currentSong: {
            trackId: 25,
            trackPosition: 134,
            upNextTrackId: [23, ...]
        }
    }
}
Clone this wiki locally