mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 05:54:26 +01:00
Home sweet home (#3313)
* Link to store home, show home only if there is no store * Handle store guest case * Apply correct policies to nav items
This commit is contained in:
@@ -78,14 +78,23 @@ namespace BTCPayServer.Controllers
|
||||
var storeId = HttpContext.GetUserPrefsCookie()?.CurrentStoreId;
|
||||
if (storeId != null)
|
||||
{
|
||||
// verify store exists and redirect to it
|
||||
var store = await _storeRepository.FindStore(storeId, userId);
|
||||
if (store != null)
|
||||
{
|
||||
HttpContext.SetStoreData(store);
|
||||
return store.Role == StoreRoles.Owner
|
||||
? RedirectToAction("Dashboard", "UIStores", new { storeId })
|
||||
: RedirectToAction("ListInvoices", "UIInvoice", new { storeId });
|
||||
}
|
||||
}
|
||||
|
||||
var stores = await _storeRepository.GetStoresByUserId(userId);
|
||||
if (stores.Any())
|
||||
{
|
||||
// redirect to first store
|
||||
storeId = stores.First().Id;
|
||||
return RedirectToAction("Dashboard", "UIStores", new { storeId });
|
||||
}
|
||||
|
||||
var vm = new HomeViewModel
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user