Universal UI Login Flow

Login Action

async userSignIn({ commit, rootState, dispatch }, payload) {
    try {
        let response = await axios.post(
            `${
                rootState.config.authEndpoint
            }/oauth/token?grant_type=password`,
            {},
            {
                headers: {
                    Accept: 'application/json',
                    Authorization:
                        'Basic ' +
                        btoa(payload.name + ':' + payload.password),
                    'Content-Type': 'application/json'
                }
            }
        );
        let token = response.data.access_token;
        await dispatch('checkToken', token);
    }
    catch(e) {
        commit('setUserName', null);
        commit('setAuthenticated', false);
        commit(
            'setError',
            'Invalid username or password or combination. Please try again.'
        );
        return e;
    }
}

Validate Token

async checkToken({ commit, rootState, dispatch }, token) {
    try {
        let response = axios.post(
            `${
                rootState.config.authEndpoint
            }/oauth/check_token?token=${token}`,
            {},
            {
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json'
                }
            }
        )
        dispatch('setAccessToken', response);
        return response;
    }
    catch(e) {
        commit('setUserName', null);
        commit('setAuthenticated', false);
        commit(
            'setError',
            'Invalid username or password or combination. Please try again.'
        );
        return e;
    }
}

Commit Token to Store

setAccessToken({ commit }, payload) {
    commit('accessToken', payload);
    window.$cookies.set('app-access-token', payload);
    commit('setServiceHeaders', {
        headers: {
            'Accept': 'application/json',
            'Authorization': 'Bearer ' + payload,
            'Content-Type': 'application/json',
        }
    });
    return;
}

Adjust Magic Mouse Speed

Open Terminal.app
defaults read -g com.apple.mouse.scaling
Shows what the current speed is (default max is like 3.0)
defaults write -g com.apple.mouse.scaling 8.0
Changes speed to 8.0. Adjust value according to your preferences.
Restart may be required.

Applying .gitignore to Committed Files

1. Add / remove files to .gitignore 2. [optional] See files that are included in the exclude list:
git ls-files -ci --exclude-standard
3. Remove the committed files from repository (doesn’t remove the actual files from disk, only de-commits them)
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached