feat: update my watchlist page

This commit is contained in:
Maël Gangloff
2024-07-27 18:53:07 +02:00
parent f8f9aeb416
commit 530b4fcada
6 changed files with 237 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
import axios, {AxiosRequestConfig, AxiosResponse} from "axios";
type EventAction =
export type EventAction =
'registration'
| 'reregistration'
| 'last changed'

View File

@@ -1,7 +1,7 @@
import {Event, request, Watchlist} from "./index";
import {Event, EventAction, request, Watchlist} from "./index";
export async function getWatchlists() {
const response = await request<{ token: string }[]>({
const response = await request({
url: 'watchlists'
})
return response.data
@@ -14,7 +14,7 @@ export async function getWatchlist(token: string) {
return response.data
}
export async function postWatchlist(domains: string[], triggers: Event[]) {
export async function postWatchlist(domains: string[], triggers: { action: string, event: EventAction }[]) {
const response = await request<{ token: string }>({
method: 'POST',
url: 'watchlists',