@@ -4,6 +4,7 @@ import { forceReloadAfterAccountMerge } from './auth-nav';
|
||||
import { resetStoresSessionBootstrap } from './stores-session';
|
||||
import { resetHomeCatalogBootstrap } from './home-catalog-session';
|
||||
import { reportClientValidationError } from './client-error';
|
||||
import { showFloatingToast } from './floating-toast';
|
||||
|
||||
function resolveApiBase(): string {
|
||||
const origin =
|
||||
@@ -126,7 +127,13 @@ export async function request<T = unknown>(path: string, options: ReqOptions = {
|
||||
}
|
||||
|
||||
export function toast(title: string, icon: 'success' | 'error' | 'none' = 'none') {
|
||||
Taro.showToast({ title, icon, duration: 1800 });
|
||||
const text = title.trim();
|
||||
if (!text) return;
|
||||
if (icon !== 'success' && showFloatingToast(text)) {
|
||||
void Taro.hideToast();
|
||||
return;
|
||||
}
|
||||
Taro.showToast({ title: text, icon, duration: 1800 });
|
||||
}
|
||||
|
||||
export type SessionPayload = {
|
||||
|
||||
Reference in New Issue
Block a user