join the channel of the room you want to subscribe on the server you just initialized a socket on

This commit is contained in:
Guillem George 2026-05-16 12:18:35 +02:00
parent 2b7b6b8684
commit 02ac670fe1
4 changed files with 81 additions and 35 deletions

View file

@ -139,15 +139,19 @@ async function authedAPIRequest(endpoint, options) {
// return null;
// }
if (!options.headers) {
options.headers = {};
// Deep copy req
const request = JSON.parse(JSON.stringify(options));
if (!request.headers) {
request.headers = {};
}
options.headers.Authorization = "Bearer " + localStorage.getItem("token");
// Pcq ce PUTAIN de js est pas foutu de faire ce qu'on lui demande
request.headers.Authorization = "Bearer " + localStorage.getItem("token");
const full_endpoint = import.meta.env.VITE_URL + "/api" + endpoint;
const response = await fetch(full_endpoint, options);
const response = await fetch(full_endpoint, request);
if (response.status === 401) {
const response_err = await response.text();