Socket
Socket
Sign inDemoInstall

@n3/browser-messages

Package Overview
Dependencies
48
Maintainers
9
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @n3/browser-messages

Browser messages for n3 interfaces


Version published
Weekly downloads
72
decreased by-55.83%
Maintainers
9
Install size
27.6 MB
Created
Weekly downloads
 

Readme

Source

@n3/browser-messages

Всплывающие уведомления для приложений на базе @n3/kit.

❗Если используется отдельно от @n3/kit, необходимо подключить тему @n3/css-base

import { theme } from '@n3/css-base/themes/theme-2';
import { setTheme } from '@n3/css-base';

setTheme(theme);

Успешное уведомление

import { successLog } from '@n3/browser-messages';

successLog({
  title: 'Успешно',
  content: 'Действие прошло успешно',
});

Уведомление об ошибке

import { errorLog } from '@n3/browser-messages';

errorLog({
  title: 'Ошибка',
  content: 'Действие прошло с ошибкой',
});

Параметры

НазваниеОписаниеЗначение по умолчанию
titleЗаголовок
contentСодержание
isAutoCloseЗакрытие по таймаутуfalse
timeoutВремя показа до закрытия4500
zIndexz-index fixed-элемента20

Интергация с axios

Выводит ошибку из поля detail или non_field_errors.

import axios from 'axios';
import { axiosErrorLog } from '@n3/browser-messages';

try {
  await axios.post(...);
} catch (e) {
  axiosErrorLog(e);
}

Аргументы:

  1. axiosError - обязательный, ошибка axios;
  2. message - необязательный, дополнительные параметры вывода сообщения;
  3. order - необязательный, порядок, по которому в ответе производится поиск ошибки, по умолчанию ['detail', 'non_field_errors'].

Keywords

FAQs

Last updated on 18 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc