Add JSDoc documentation and file headers to all source files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 18:55:36 +08:00
parent 3b7b6ae859
commit 7fec6cb63f
199 changed files with 2764 additions and 503 deletions

View File

@@ -1,15 +1,30 @@
// The Lucia project.
// Copyright 2023-2026 DSP, inc. All rights reserved.
// Authors:
// chiayin.kuo@dsp.im (chiayin), 2023/1/31
// imacat.yang@dsp.im (imacat), 2023/9/23
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
/** @module apiError Centralized API error handler with toast notifications. */
import { useLoadingStore } from '@/stores/loading';
import {useToast} from 'vue-toast-notification';
import 'vue-toast-notification/dist/theme-sugar.css';
// Delay loading and toast
/**
* Returns a promise that resolves after the specified milliseconds.
* @param {number} [s=0] - The delay in milliseconds.
* @returns {Promise<void>} A promise that resolves after the delay.
*/
const delay = (s = 0) => new Promise((resolve, reject) => setTimeout(resolve, s));
/**
* API catch error function.
* 401 errors are handled by the axios response interceptor in api/client.js.
* @param {object} error 後端 ERROR
* @param {string} toastMessage Toast 的提示文字
* Handles API errors by showing a loading spinner followed by a toast
* notification. 401 errors are handled by the axios response interceptor
* in api/client.js.
*
* @param {Object} error - The error object from the API call.
* @param {string} toastMessage - The message to display in the toast.
* @returns {Promise<void>}
*/
export default async function apiError(error, toastMessage) {
const loading = useLoadingStore();