Skip to content

Commit

Permalink
chore: merge pull request #4 from raphckrman/feature/history
Browse files Browse the repository at this point in the history
fix(fetch): omit credentials
  • Loading branch information
Vexcited authored Nov 6, 2024
2 parents 0cc908c + 1a56f21 commit 5ae2883
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/api/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export interface ConsumptionHistoryEvent {

export const getFinancialHistory = async (uid: number, startTimestamp: number, endTimestamp: number, limit: number = 30, cookies: string[]): Promise<FinancialHistoryEvent[]> => {
const response = await fetch(createAjaxEndpoint(`?eID=tx_afereload_ajax_financialhistory&fe_uid=${uid}&startTimestamp=${startTimestamp}&endTimestamp=${endTimestamp}&page=1&start=0&limit=${limit}`), {
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT }
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT },
credentials: "omit"
});

const data = await response.json() as unknown as { total: number, operations: FinancialHistoryEvent[] };
Expand All @@ -41,7 +42,8 @@ export const getFinancialHistory = async (uid: number, startTimestamp: number, e

export const getOrdersHistory = async (uid: number, startTimestamp: number, endTimestamp: number, limit: number = 30, cookies: string[]): Promise<OrderHistoryEvent[]> => {
const response = await fetch(createAjaxEndpoint(`?eID=tx_afereload_ajax_ordershistory&fe_uid=${uid}&startTimestamp=${startTimestamp}&endTimestamp=${endTimestamp}&page=1&start=0&limit=${limit}`), {
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT }
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT },
credentials: "omit"
});

const data = await response.json() as unknown as { total: number, orders: OrderHistoryEvent[] };
Expand All @@ -50,7 +52,8 @@ export const getOrdersHistory = async (uid: number, startTimestamp: number, endT

export const getConsumptionsHistory = async (uid: number, startTimestamp: number, endTimestamp: number, limit: number = 30, cookies: string[]): Promise<ConsumptionHistoryEvent[]> => {
const response = await fetch(createAjaxEndpoint(`?eID=tx_afereload_ajax_consumptionhistory&fe_uid=${uid}&startTimestamp=${startTimestamp}&endTimestamp=${endTimestamp}&page=1&start=0&limit=${limit}`), {
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT }
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT },
credentials: "omit"
});

const data = await response.json() as unknown as { total: number, consumptions: ConsumptionHistoryEvent[] };
Expand Down
5 changes: 3 additions & 2 deletions src/api/online-payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ export type WalletData = {
);

export const getOnlinePayments = async (schoolID: string, cookies: string[]): Promise<OnlinePayments> => {
const response = await fetch(createEndpointURL(schoolID, "menu-utilisateur/paiement-en-ligne.html"), {
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT }
const response = await fetch(createEndpointURL(schoolID, "menu-utilisateur/paiement-en-ligne.html") + "?no_cache=1", {
headers: { "Cookie": cookies.join("; "), "User-Agent": USER_AGENT },
credentials: "omit"
});

const html = await response.text();
Expand Down

0 comments on commit 5ae2883

Please sign in to comment.