Comments, appointments adjustments, fixed some issues
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
//Base path for all cart API calls
|
||||
const BASE = "/api/v1/cart";
|
||||
|
||||
//Returns the standard headers needed for authenticated requests
|
||||
function authHeaders(token) {
|
||||
return {
|
||||
"Content-Type": "application/json",
|
||||
@@ -7,6 +9,7 @@ function authHeaders(token) {
|
||||
};
|
||||
}
|
||||
|
||||
//Parses the response and throws an error if the request failed
|
||||
async function handleResponse(res) {
|
||||
if (res.status === 204) return null;
|
||||
const data = await res.json();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Client } from "@stomp/stompjs";
|
||||
|
||||
//Backend URL for the WebSocket connection, empty string means same origin
|
||||
const BACKEND_URL = process.env.NEXT_PUBLIC_BACKEND_URL || "";
|
||||
|
||||
//Creates a STOMP client that connects to the chat WebSocket with the user's token
|
||||
export function createStompClient(token) {
|
||||
return new Client({
|
||||
webSocketFactory: () => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//Fetches every page from a paginated API and returns all items in one array
|
||||
export async function fetchAllPages(urlBuilder) {
|
||||
const items = [];
|
||||
let page = 0;
|
||||
|
||||
Reference in New Issue
Block a user