This commit is contained in:
Parsa Nazer
2025-01-27 21:28:44 +03:30
5 changed files with 34 additions and 7 deletions
@@ -6,7 +6,7 @@ import { useAuth } from "~/composables/api/auth/useAuth";
// types
export type GetAccountResponse = Product;
export type GetAccountResponse = Account;
const useGetAccount = () => {
+1 -1
View File
@@ -36,5 +36,5 @@ export const MUTATION_KEYS = {
export const PRODUCT_RANGE = {
min: 0,
max: 100000,
max: 100_000_000,
};
+2 -2
View File
@@ -2,7 +2,7 @@
export default defineNuxtConfig({
compatibilityDate: "2024-11-01",
ssr: true,
devtools: { enabled: false },
devtools: { enabled: true },
css: ["~/assets/css/tailwind.css", "swiper/css"],
routeRules: {
@@ -53,7 +53,7 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
API_BASE_URL: "http://38.60.202.91:8001",
API_BASE_URL: "https://api.heymlz.com",
},
},
});
+22 -3
View File
@@ -1,4 +1,5 @@
import fs from "fs/promises";
import type { AxiosError } from "axios";
type LogType = {
title: string;
@@ -47,11 +48,12 @@ class Logger {
break;
}
markdownContent += `# ${icon} ${log.title} \n`;
markdownContent += `## ${[year, month, day].join("-")} ${hour}:${minutes}:${seconds} \n`;
markdownContent += `## ${icon} ${log.title} \n`;
// markdownContent += `## ${[year, month, day].join("-")} ${hour}:${minutes}:${seconds} \n`;
markdownContent += `## ${hour} : ${minutes} : ${seconds} \n`;
if (log.message) {
markdownContent += `**Message:** ${log.message}\n`;
markdownContent += `**Message:**\n ${log.message}\n\n`;
}
if (log.details) {
markdownContent += `**Details:**\n\n\`\`\`json\n${JSON.stringify(log.details, null, 2)}\n\`\`\`\n\n`;
@@ -72,6 +74,23 @@ class Logger {
console.error(e);
}
}
public static async axiosErrorLog(error: any) {
const logData : LogType = {
title : error?.message,
message : `${error?.config?.method?.toUpperCase()} ${error?.config?.url}`,
details : error,
}
const formattedLog = this.formatToMarkdown(logData);
try {
await fs.appendFile(".logs/log.md", formattedLog);
} catch (e) {
console.error(e);
}
}
}
export default Logger;
+8
View File
@@ -14,6 +14,14 @@ declare global {
content: string;
};
type Account = {
first_name: string;
last_name: string;
email: string;
profile_photo: string;
phone: string;
}
type Product = {
id: number;
price: number;