api to ts

This commit is contained in:
Adria Navarro 2025-01-09 11:34:15 +01:00
parent 96cee21792
commit f938eb3297
3 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,10 @@
import { createAPIClient } from "@budibase/frontend-core" import { createAPIClient } from "@budibase/frontend-core"
import { authStore } from "../stores/auth.js" import { authStore } from "../stores/auth.js"
import { notificationStore, devToolsEnabled, devToolsStore } from "../stores/" import {
notificationStore,
devToolsEnabled,
devToolsStore,
} from "../stores/index.js"
import { get } from "svelte/store" import { get } from "svelte/store"
export const API = createAPIClient({ export const API = createAPIClient({

View File

@ -1,4 +1,4 @@
import { API } from "./api.js" import { API } from "./api.ts"
import { patchAPI } from "./patches.js" import { patchAPI } from "./patches.js"
// Certain endpoints which return rows need patched so that they transform // Certain endpoints which return rows need patched so that they transform

View File

@ -18,7 +18,7 @@ const createNotificationStore = () => {
type = "info", type = "info",
icon: string, icon: string,
autoDismiss = true, autoDismiss = true,
duration: number, duration?: number,
count = 1 count = 1
) => { ) => {
if (block) { if (block) {
@ -77,13 +77,13 @@ const createNotificationStore = () => {
subscribe: store.subscribe, subscribe: store.subscribe,
actions: { actions: {
send, send,
info: (msg: string, autoDismiss: boolean, duration: number) => info: (msg: string, autoDismiss?: boolean, duration?: number) =>
send(msg, "info", "Info", autoDismiss ?? true, duration), send(msg, "info", "Info", autoDismiss ?? true, duration),
success: (msg: string, autoDismiss: boolean, duration: number) => success: (msg: string, autoDismiss?: boolean, duration?: number) =>
send(msg, "success", "CheckmarkCircle", autoDismiss ?? true, duration), send(msg, "success", "CheckmarkCircle", autoDismiss ?? true, duration),
warning: (msg: string, autoDismiss: boolean, duration: number) => warning: (msg: string, autoDismiss?: boolean, duration?: number) =>
send(msg, "warning", "Alert", autoDismiss ?? true, duration), send(msg, "warning", "Alert", autoDismiss ?? true, duration),
error: (msg: string, autoDismiss: boolean, duration: number) => error: (msg: string, autoDismiss?: boolean, duration?: number) =>
send(msg, "error", "Alert", autoDismiss ?? false, duration), send(msg, "error", "Alert", autoDismiss ?? false, duration),
blockNotifications, blockNotifications,
dismiss, dismiss,