summaryrefslogtreecommitdiffstats
path: root/web/react/pages/home.jsx
blob: a59f2afd0c8a126ab5d933371fae35275309ef6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

var ChannelStore = require('../stores/channel_store.jsx');
var TeamStore = require('../stores/team_store.jsx');
var Constants = require('../utils/constants.jsx');

function setupHomePage() {
    var last = ChannelStore.getLastVisitedName();
    if (last == null || last.length === 0) {
        window.location = TeamStore.getCurrentTeamUrl() + '/channels/' + Constants.DEFAULT_CHANNEL;
    } else {
        window.location = TeamStore.getCurrentTeamUrl() + '/channels/' + last;
    }
}

global.window.setup_home_page = setupHomePage;