Changements amitiés

This commit is contained in:
batche
2022-12-11 15:30:30 +01:00
parent db1e269e2e
commit a9460fb41c
7 changed files with 200 additions and 155 deletions

View File

@@ -15,7 +15,7 @@ Ideas
could be a list of friends and if they're active but i can't see that yet
- I click on a thing and it lets me see all the users and i get a button that lets me add them
- would that be like a serachable list of all users?
- am i skipping optimization? i mean for now yes, but like
- am i skipping optimization? i mean for now yes, but like
@@ -32,12 +32,12 @@ could be a list of friends and if they're active but i can't see that yet
let myFriends;
let requestsMade, requestsRecieved;
let userBeingViewed;
onMount( async() => {
// yea no idea what
// i mean do i fetch user? i will for now
// yea no idea what
// i mean do i fetch user? i will for now
user = await fetch('http://transcendance:8080/api/v2/user')
.then( (x) => x.json() );
@@ -82,13 +82,13 @@ could be a list of friends and if they're active but i can't see that yet
const displayAllFriends = async() => {
myFriends = await fetch('http://transcendance:8080/api/v2/network/myfriends')
.then( x => x.json() );
.then( x => x.json() );
// console.log('got all friends ' + allFriends)
};
const displayRequestsMade = async() => {
requestsMade = await fetch('http://transcendance:8080/api/v2/network/pending')
.then( x => x.json() );
.then( x => x.json() );
// console.log('got requests made ' + requestsMade)
};
@@ -110,8 +110,7 @@ could be a list of friends and if they're active but i can't see that yet
method : "POST",
headers: { 'Content-Type': 'application/json'},
body: JSON.stringify({
"requesterUsername": user.username,
"addresseeUsername": set.friendUsername,
"receiverUsername": set.friendUsername,
"status": "R"
})
})
@@ -131,7 +130,7 @@ could be a list of friends and if they're active but i can't see that yet
};
const blockAUser = async(friendshipId) => {
};
@@ -146,7 +145,7 @@ could be a list of friends and if they're active but i can't see that yet
{#if allUsers === undefined}
<div class="error">Failed to load all users</div>
{:else}
<!-- problem, i can't use user.id since Cherif doesn't want to expost that to the front...
<!-- problem, i can't use user.id since Cherif doesn't want to expost that to the front...
is there something else i could use? -->
<!-- add a thing so it doesn't display the current user just all the other users -->
@@ -196,7 +195,7 @@ could be a list of friends and if they're active but i can't see that yet
<DisplayAUser aUsername={userBeingViewed.username}/>
<Button type="secondary" on:click={() => sendFriendRequest(userBeingViewed.username)}>Add Friend</Button>
{:catch}
<p>No user to view yet</p>
{/await} -->
@@ -227,7 +226,7 @@ could be a list of friends and if they're active but i can't see that yet
{/each}
{/if} -->
<!-- <br> <br> -->
<!-- here i want to list all the requests you and have an accept and a decline button -->
@@ -291,4 +290,4 @@ could be a list of friends and if they're active but i can't see that yet
font-weight: bold;
color: red;
}
</style>
</style>