From 8895bc5363eb78dc04db6ea50f1b028bf807a3c6 Mon Sep 17 00:00:00 2001
From: Christoph Wurst <christoph@winzerhof-wurst.at>
Date: Mon, 25 Mar 2019 16:00:50 +0100
Subject: [PATCH] Fetch the folders of a newly created account

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
---
 src/store/actions.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/store/actions.js b/src/store/actions.js
index b2b9bf308..c9a3deea7 100644
--- a/src/store/actions.js
+++ b/src/store/actions.js
@@ -59,7 +59,18 @@ export default {
 		return createAccount(config).then(account => {
 			console.debug('account created', account)
 			commit('addAccount', account)
-			return account
+
+			fetchAllFolders(account.id)
+				.then(folders =>
+					folders.forEach(folder => {
+						commit('addFolder', {
+							account,
+							folder,
+						})
+					})
+				)
+				.then(() => console.info("new account's folders fetched"))
+				.then(() => account)
 		})
 	},
 	updateAccount({commit}, config) {
-- 
GitLab