Query Builder, more specifically an orWhere, is being difficult... hard to test the friendships flow in the frontend without it, still have a good bit of work as a result

This commit is contained in:
Me
2022-12-15 05:42:09 +01:00
parent 6eaf28d4d8
commit db02946268
3 changed files with 153 additions and 14 deletions

View File

@@ -69,6 +69,22 @@
console.log({...requestsRecieved})
};
let cherifFetch;
const fetchCherif = async() => {
cherifFetch = await fetch('http://transcendance:8080/api/v2/network/myfriends/chbadad')
.then( x => x.json() );
console.log('Cherif Fetched ')
console.log({...cherifFetch})
};
let ericFetch;
const fetchEric = async() => {
ericFetch = await fetch('http://transcendance:8080/api/v2/network/myfriends/erlazo')
.then( x => x.json() );
console.log('Eric Fetched ')
console.log({...ericFetch})
};
let sentFriendRequest;
const sendFriendRequest = async(potentialFriendUsername) => {
set.friendUsername = '';
@@ -92,6 +108,7 @@
})
})
.then( x => x.json())
areWeFriends(usernameBeingViewed);
}
};
@@ -100,6 +117,7 @@
friendshipStatusFull = undefined;
friendshipStatusFull = await fetch(`http://transcendance:8080/api/v2/network/myfriends/${aUsername}`)
.then( x => x.json());
console.log({...friendshipStatusFull})
};
const viewAUser = async(aUsername) => {
@@ -116,6 +134,16 @@
};
let tmpTest;
const testBack = async(relationshipId) => {
console.log('test back request')
tmpTest = undefined;
// PATCH http://transcendance:8080/api/v2/network/myfriends/:relationshipId/test
tmpTest = await fetch(`http://transcendance:8080/api/v2/network/myfriends/${relationshipId}/test`)
.then( x => x.json());
};
const acceptFriendRequest = async(relationshipId) => {
console.log('accept friend request')
friendshipFetch = undefined;
@@ -124,6 +152,8 @@
method: "PATCH"})
.then( x => x.json());
// maybe not the most robust things, not super reusable cuz it depends on outside vars but works for now...
console.log('accepted friend request, now response')
console.log({...friendshipFetch})
await areWeFriends(usernameBeingViewed);
};
@@ -266,7 +296,9 @@
{/if} -->
<!-- {:else if userBeingViewed !== undefined} -->
<!-- <Button on:click={fetchAFriend}>Get Cherif</Button> -->
<Button on:click={() => testBack(1)}>Test Friendship Back</Button>
<Button on:click={fetchCherif}>Fetch Cherif</Button>
<Button on:click={fetchEric}>Fetch Eric</Button>
</div>
</div>