From 3cd5651a509a8cf8a725d68dd8f8b1f34d637769 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:05:52 +0000 Subject: [PATCH] minor const refactor --- src/store/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index b1c8e4a..cb055a6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -18,8 +18,6 @@ import { } from "firebase/firestore"; import { firebaseAuth, firebaseFirestore } from "@/firebase.js"; -const API_ENDPOINT = "https://auto-archiver-api.bellingcat.com"; - export default createStore({ state: { user: null, @@ -28,6 +26,7 @@ export default createStore({ docs: [], loading: false, errorMessage: "", + API_ENDPOINT: "https://auto-archiver-api.bellingcat.com" }, mutations: { setUser(state, user) { @@ -93,11 +92,11 @@ export default createStore({ } }, - async checkActiveUser({ state, commit, dispatch }) { + async checkActiveUser({ state, commit }) { try { commit("setErrorMessage", ""); const r = await fetch( - `${API_ENDPOINT}/user/active`, + `${state.API_ENDPOINT}/user/active`, { method: "GET", headers: { @@ -112,7 +111,6 @@ export default createStore({ console.error("checkActiveUser (firebase.js): ", error); commit("setErrorMessage", "Unable to check user status against the API"); } - }, async getDocs({ state, commit }) { @@ -152,7 +150,7 @@ export default createStore({ // send a post request to the API with the sheet ID in the body // and a bearer auth token in the header await fetch( - `${API_ENDPOINT}/sheet`, + `${state.API_ENDPOINT}/sheet`, { method: "POST", headers: {