Files
tiny-forge/web/.svelte-kit/output/server/chunks/toast.js
T
alexei.dolgolyov 670948f113 fix: address code review findings for DNS management
- CRITICAL: Change DNS zones endpoint from GET to POST to avoid
  leaking API token in URL query parameters
- HIGH: Add sync.RWMutex to protect dnsProvider field in Server,
  Deployer, and proxy Manager against concurrent read/write races
- HIGH: Capture old DNS provider reference synchronously before
  launching background cleanup goroutine
- HIGH: Use getDNS()/getDNSProviderLocked() accessors instead of
  direct field reads in all DNS operations
2026-04-02 14:54:15 +03:00

43 lines
1.0 KiB
JavaScript

import { w as writable } from "./index3.js";
function createToastStore() {
const { subscribe, update } = writable([]);
let counter = 0;
function add(message, type = "info", duration = 5e3) {
const id = `toast-${++counter}-${Date.now()}`;
const toast = { id, message, type, duration };
update((toasts2) => [...toasts2, toast]);
if (duration > 0) {
setTimeout(() => remove(id), duration);
}
return id;
}
function remove(id) {
update((toasts2) => toasts2.filter((t) => t.id !== id));
}
function success(message, duration = 5e3) {
return add(message, "success", duration);
}
function error(message, duration = 7e3) {
return add(message, "error", duration);
}
function warning(message, duration = 5e3) {
return add(message, "warning", duration);
}
function info(message, duration = 5e3) {
return add(message, "info", duration);
}
return {
subscribe,
add,
remove,
success,
error,
warning,
info
};
}
const toasts = createToastStore();
export {
toasts as t
};