/*
* index.js
* Copyright (c) 2018 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see .
*/
$(function () {
"use strict";
//var status = $('#status-box');
// set HTML to "migrating...":
startMigration();
});
function startMigration() {
$('#status-box').html(' Setting up DB...');
$.post(migrateUri, {_token: token}).done(function () {
startPassport();
}).fail(function () {
$('#status-box').html(' Migration failed! See log files :(');
});
}
/**
*
*/
function startPassport() {
$('#status-box').html(' Setting up OAuth2...');
$.post(keysUri, {_token: token}).done(function () {
startUpgrade();
}).fail(function () {
$('#status-box').html(' OAuth2 failed! See log files :(');
});
}
/**
*
*/
function startUpgrade() {
$('#status-box').html(' Upgrading database...');
$.post(upgradeUri, {_token: token}).done(function () {
completeDone();
}).fail(function () {
$('#status-box').html(' Upgrade failed! See log files :(');
});
}
/**
*
*/
function completeDone() {
$('#status-box').html(' Installation complete! Wait to be redirected...');
setTimeout(function () {
window.location = homeUri;
}, 3000);
}