add pages to see all the offers to user and offers to user's projects

This commit is contained in:
2024-11-05 19:03:12 -07:00
parent 0d880d1edc
commit c004706425
7 changed files with 374 additions and 48 deletions

View File

@@ -593,17 +593,21 @@ export async function setPlanInCache(
/**
*
* @returns { data: Array<OfferSummaryRecord>, hitLimit: boolean }
* @returns { data: Array<OfferSummaryRecord>, hitLimit: boolean true if maximum was hit and there may be more }
*/
export async function getNewOffersToUser(
axios: Axios,
apiServer: string,
activeDid: string,
lastAckedOfferToUserJwtId?: string,
afterOfferJwtId?: string,
beforeOfferJwtId?: string,
) {
let url = `${apiServer}/api/v2/report/offers?recipientDid=${activeDid}`;
if (lastAckedOfferToUserJwtId) {
url += "&afterId=" + lastAckedOfferToUserJwtId;
if (afterOfferJwtId) {
url += "&afterId=" + afterOfferJwtId;
}
if (beforeOfferJwtId) {
url += "&beforeId=" + beforeOfferJwtId;
}
const headers = await getHeaders(activeDid);
const response = await axios.get(url, { headers });
@@ -611,17 +615,22 @@ export async function getNewOffersToUser(
}
/**
*
* @returns { data: Array<OfferToPlanSummaryRecord>, hitLimit: boolean }
* @returns { data: Array<OfferToPlanSummaryRecord>, hitLimit: boolean true if maximum was hit and there may be more }
*/
export async function getNewOffersToUserProjects(
axios: Axios,
apiServer: string,
activeDid: string,
lastAckedOfferToUserProjectsJwtId?: string,
afterOfferJwtId?: string,
beforeOfferJwtId?: string,
) {
let url = `${apiServer}/api/v2/report/offersToPlansOwnedByMe`;
if (lastAckedOfferToUserProjectsJwtId) {
url += "?afterId=" + lastAckedOfferToUserProjectsJwtId;
if (afterOfferJwtId) {
url += "?afterId=" + afterOfferJwtId;
}
if (beforeOfferJwtId) {
url += afterOfferJwtId ? "&" : "?";
url += "beforeId=" + beforeOfferJwtId;
}
const headers = await getHeaders(activeDid);
const response = await axios.get(url, { headers });