mirror of
https://github.com/bellingcat/auto-archiver-setup-tool.git
synced 2026-06-13 05:58:37 +03:00
minor const refactor
This commit is contained in:
@@ -18,8 +18,6 @@ import {
|
|||||||
} from "firebase/firestore";
|
} from "firebase/firestore";
|
||||||
import { firebaseAuth, firebaseFirestore } from "@/firebase.js";
|
import { firebaseAuth, firebaseFirestore } from "@/firebase.js";
|
||||||
|
|
||||||
const API_ENDPOINT = "https://auto-archiver-api.bellingcat.com";
|
|
||||||
|
|
||||||
export default createStore({
|
export default createStore({
|
||||||
state: {
|
state: {
|
||||||
user: null,
|
user: null,
|
||||||
@@ -28,6 +26,7 @@ export default createStore({
|
|||||||
docs: [],
|
docs: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
errorMessage: "",
|
errorMessage: "",
|
||||||
|
API_ENDPOINT: "https://auto-archiver-api.bellingcat.com"
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setUser(state, user) {
|
setUser(state, user) {
|
||||||
@@ -93,11 +92,11 @@ export default createStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async checkActiveUser({ state, commit, dispatch }) {
|
async checkActiveUser({ state, commit }) {
|
||||||
try {
|
try {
|
||||||
commit("setErrorMessage", "");
|
commit("setErrorMessage", "");
|
||||||
const r = await fetch(
|
const r = await fetch(
|
||||||
`${API_ENDPOINT}/user/active`,
|
`${state.API_ENDPOINT}/user/active`,
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -112,7 +111,6 @@ export default createStore({
|
|||||||
console.error("checkActiveUser (firebase.js): ", error);
|
console.error("checkActiveUser (firebase.js): ", error);
|
||||||
commit("setErrorMessage", "Unable to check user status against the API");
|
commit("setErrorMessage", "Unable to check user status against the API");
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getDocs({ state, commit }) {
|
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
|
// send a post request to the API with the sheet ID in the body
|
||||||
// and a bearer auth token in the header
|
// and a bearer auth token in the header
|
||||||
await fetch(
|
await fetch(
|
||||||
`${API_ENDPOINT}/sheet`,
|
`${state.API_ENDPOINT}/sheet`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user