ok gotta test all the paths but we more or less have the friendships and users modules working the new way
This commit is contained in:
@@ -93,23 +93,28 @@
|
||||
const fetchFriendshipFull = async(aUsername) => {
|
||||
console.log('fetch friendship from a username')
|
||||
console.log(aUsername)
|
||||
friendshipStatusFull = await fetch(`http://transcendance:8080/api/v2/network/myfriends/${aUsername}`)
|
||||
friendshipStatusFull = await fetch(`http://transcendance:8080/api/v2/network/myfriends?username=${aUsername}`)
|
||||
.then( x => x.json());
|
||||
console.log({...friendshipStatusFull})
|
||||
};
|
||||
|
||||
|
||||
const sendFriendRequest = async(aUser) => {
|
||||
|
||||
const sendFriendRequest = async(aUsername) => {
|
||||
console.log('sending a friend request')
|
||||
console.log(aUsername)
|
||||
const resp = await fetch("http://transcendance:8080/api/v2/network/relations", {
|
||||
method : "POST",
|
||||
headers: { 'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({
|
||||
"receiverUsername": aUser.username,
|
||||
"receiverUsername": aUsername,
|
||||
"status": "R"
|
||||
})
|
||||
})
|
||||
.then( x => x.json())
|
||||
fetchFriendshipFull(aUser.username);
|
||||
// .catch( x => console.log({...x}))
|
||||
// "status": "A"
|
||||
console.log({...resp})
|
||||
fetchFriendshipFull(aUsername);
|
||||
};
|
||||
|
||||
const viewAUser = async(aUsername) => {
|
||||
@@ -335,6 +340,7 @@
|
||||
<Button type="secondary" on:click={() => sendFriendRequest(usernameBeingViewed)}>Add Friend</Button>
|
||||
<Button on:click={() => blockANonFriendUser(usernameBeingViewed)}>Block User</Button>
|
||||
{/if}
|
||||
<Button type="secondary" on:click={() => sendFriendRequest(usernameBeingViewed)}>Add Friend</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="placeholder">
|
||||
|
||||
Reference in New Issue
Block a user