feat: update authentication handling and integrate token usage across frontend and backend

This commit is contained in:
Siddhant Rai
2025-03-18 08:29:57 +05:30
parent 4406426515
commit 6583aeff08
19 changed files with 430 additions and 186 deletions

View File

@@ -1,20 +1,22 @@
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { getDocs } from '../preferences/preferenceApi';
import { Doc } from '../models/misc';
import { getDocs } from '../preferences/preferenceApi';
import {
selectSelectedDocs,
selectToken,
setSelectedDocs,
setSourceDocs,
} from '../preferences/preferenceSlice';
export default function useDefaultDocument() {
const dispatch = useDispatch();
const token = useSelector(selectToken);
const selectedDoc = useSelector(selectSelectedDocs);
const fetchDocs = () => {
getDocs().then((data) => {
getDocs(token).then((data) => {
dispatch(setSourceDocs(data));
if (!selectedDoc)
Array.isArray(data) &&