mataghva / Footprint

Footprint is a site that users can search for trails/parks, get information and write a review for them
0 stars 0 forks source link

README

alt text Footprint is a website that users can find information about trails. It's a clone of the original alltrails.com website.

Features

Users can:

Footprint Live

Technologies

These technologies are used to develop this website:

User Authentication Features

Error Message Handling

To have better error messages for sign-up/log-in and review forms, separate slices of error data in the state are created. To achieve this goal, separate reducers are created:

import {
    RECEIVE_SESSION_ERRORS,
    RECEIVE_CURRENT_USER,
    CLEAR_ERRORS
} from '../actions/session_actions';

const sessionErrorsReducer = (state = [], action) => {
    Object.freeze(state);
    switch (action.type) {
        case RECEIVE_SESSION_ERRORS:
            console.log(action.errors)
            return action.errors;
        case RECEIVE_CURRENT_USER:
            return [];
        case CLEAR_ERRORS:
            return [];
        default:
            return state;
    };
};

export default sessionErrorsReducer;
import { combineReducers } from 'redux';
import reviewErrorsReducer from './review_errors_reducer';
import sessionErrorsReducer from './session_errors_reducer';

const errorsReducer = combineReducers({
    session: sessionErrorsReducer,
    review: reviewErrorsReducer
});

export default errorsReducer;

Then the errors slice of state would be like this:

errors: {
        session: ["Incorrect username/password combination"],
        review: ["title cannot be blank"],
    },

Future Goals

The following features haven't been finished yet and will be added in the future:

Calorie Calculator

It's a handy feature to be added to the website to calculate the amount of calories that the user burns walking the trails. To accomplish this, some more user's information like height, weight, and age is needed.