Lint frontend (#131)

* Add lint-fix npm target

* Sync eslint+plugins with backend

* Add prettier

* Ignore no-explicit-any lint rule for now

* Silence eslint react warning

* Format frontend via prettier

* Lint frontend.

---------

Co-authored-by: antanst <>
This commit is contained in:
Antonis Anastasiadis 2025-07-09 12:23:55 +03:00 committed by GitHub
parent f433dbffe3
commit 220bc92b4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
114 changed files with 30271 additions and 48239 deletions

View file

@ -1,50 +1,53 @@
import { Note } from "../entities/Note";
import { handleAuthResponse, getDefaultHeaders, getPostHeaders } from "./authUtils";
import { Note } from '../entities/Note';
import {
handleAuthResponse,
getDefaultHeaders,
getPostHeaders,
} from './authUtils';
export const fetchNotes = async (): Promise<Note[]> => {
const response = await fetch("/api/notes", {
credentials: 'include',
headers: getDefaultHeaders(),
});
await handleAuthResponse(response, 'Failed to fetch notes.');
const response = await fetch('/api/notes', {
credentials: 'include',
headers: getDefaultHeaders(),
});
await handleAuthResponse(response, 'Failed to fetch notes.');
return await response.json();
return await response.json();
};
export const createNote = async (noteData: Note): Promise<Note> => {
try {
const response = await fetch('/api/note', {
method: 'POST',
credentials: 'include',
headers: getPostHeaders(),
body: JSON.stringify(noteData),
method: 'POST',
credentials: 'include',
headers: getPostHeaders(),
body: JSON.stringify(noteData),
});
await handleAuthResponse(response, 'Failed to create note.');
return await response.json();
} catch (error) {
throw error;
}
};
export const updateNote = async (noteId: number, noteData: Note): Promise<Note> => {
const response = await fetch(`/api/note/${noteId}`, {
method: 'PATCH',
credentials: 'include',
headers: getPostHeaders(),
body: JSON.stringify(noteData),
});
export const updateNote = async (
noteId: number,
noteData: Note
): Promise<Note> => {
const response = await fetch(`/api/note/${noteId}`, {
method: 'PATCH',
credentials: 'include',
headers: getPostHeaders(),
body: JSON.stringify(noteData),
});
await handleAuthResponse(response, 'Failed to update note.');
return await response.json();
await handleAuthResponse(response, 'Failed to update note.');
return await response.json();
};
export const deleteNote = async (noteId: number): Promise<void> => {
const response = await fetch(`/api/note/${noteId}`, {
method: 'DELETE',
credentials: 'include',
headers: getDefaultHeaders(),
});
const response = await fetch(`/api/note/${noteId}`, {
method: 'DELETE',
credentials: 'include',
headers: getDefaultHeaders(),
});
await handleAuthResponse(response, 'Failed to delete note.');
};
await handleAuthResponse(response, 'Failed to delete note.');
};