private vaults now handled properly
This commit is contained in:
@@ -89,4 +89,8 @@ export default {
|
|||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.img-fluid {
|
||||||
|
max-height: 90vh;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -25,6 +25,7 @@ class ProfilesService {
|
|||||||
async getVaults(profileId) {
|
async getVaults(profileId) {
|
||||||
try {
|
try {
|
||||||
const res = await api.get('api/profiles/' + profileId + '/vaults')
|
const res = await api.get('api/profiles/' + profileId + '/vaults')
|
||||||
|
logger.log(res.data)
|
||||||
AppState.profileVaults = res.data
|
AppState.profileVaults = res.data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error)
|
logger.error(error)
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using System.Collections.Generic;
|
|||||||
using keepr.Models;
|
using keepr.Models;
|
||||||
using keepr.Services;
|
using keepr.Services;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using CodeWorks.Auth0Provider;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace keepr.Controllers
|
namespace keepr.Controllers
|
||||||
{
|
{
|
||||||
@@ -51,11 +54,23 @@ namespace keepr.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}/vaults")]
|
[HttpGet("{id}/vaults")]
|
||||||
public ActionResult<List<Vault>> GetProfileVaults(string id)
|
public async Task<ActionResult<List<Vault>>> GetProfileVaults(string id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Vault> vaults = _vs.GetProfileVaults(id);
|
Account userInfo = await HttpContext.GetUserInfoAsync<Account>();
|
||||||
|
List<Vault> vaults;
|
||||||
|
if (userInfo == null || userInfo?.Id != id)
|
||||||
|
{
|
||||||
|
// System.Console.WriteLine("didn't auth");
|
||||||
|
vaults = _vs.GetProfileVaults(id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// System.Console.WriteLine("authed");
|
||||||
|
vaults = _vs.GetMyVaults(id);
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(vaults);
|
return Ok(vaults);
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
|
|||||||
Reference in New Issue
Block a user