From 0f3b72830bd25023a384e4bd9f81fef0ffdf9e7e Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Fri, 15 Mar 2024 06:50:08 -0400 Subject: [PATCH] use cookie auth for frontend --- relay/frontend/static/api.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/relay/frontend/static/api.js b/relay/frontend/static/api.js index e4a1219..b0a2bff 100644 --- a/relay/frontend/static/api.js +++ b/relay/frontend/static/api.js @@ -1,15 +1,3 @@ -function get_cookie(name) { - const regex = new RegExp(`(^| )` + name + `=([^;]+)`); - const match = document.cookie.match(regex); - - if (match) { - return match[2] - } - - return null; -} - - function get_date_string(date) { var year = date.getFullYear().toString(); var month = date.getMonth().toString(); @@ -46,11 +34,6 @@ function append_table_row(table, row_name, row) { class Client { - constructor() { - this.token = get_cookie("user-token"); - } - - async request(method, path, body = null) { var headers = { "Accept": "application/json" @@ -61,10 +44,6 @@ class Client { body = JSON.stringify(body) } - if (this.token !== null) { - headers["Authorization"] = "Bearer " + this.token; - } - const response = await fetch("/api/" + path, { method: method, mode: "cors",