Compare commits

..

4 Commits

Author SHA1 Message Date
louiscklaw
5ff3393f54 add missing lib for mobile, 2025-06-13 13:33:20 +08:00
louiscklaw
5a531e1288 update add lib, 2025-06-13 13:19:15 +08:00
louiscklaw
5b7cf25753 delete test directory for production, 2025-06-13 13:08:08 +08:00
louiscklaw
19b2357771 "Update .gitignore to exclude _del and _test directories" 2025-06-13 13:06:01 +08:00
5 changed files with 202 additions and 1 deletions

View File

@@ -0,0 +1,83 @@
import type { AxiosRequestConfig } from 'axios';
import axios from 'axios';
import { CONFIG } from 'src/global-config';
// ----------------------------------------------------------------------
const axiosInstance = axios.create({ baseURL: CONFIG.serverUrl });
axiosInstance.interceptors.response.use(
(response) => response,
(error) => Promise.reject((error.response && error.response.data) || 'Something went wrong!')
);
export default axiosInstance;
// ----------------------------------------------------------------------
export const fetcher = async (args: string | [string, AxiosRequestConfig]) => {
try {
const [url, config] = Array.isArray(args) ? args : [args];
const res = await axiosInstance.get(url, { ...config });
return res.data;
} catch (error) {
console.error('Failed to fetch:', error);
throw error;
}
};
// ----------------------------------------------------------------------
export const endpoints = {
chat: '/api/chat',
kanban: '/api/kanban',
calendar: '/api/calendar',
auth: {
me: '/api/auth/me',
signIn: '/api/auth/sign-in',
signUp: '/api/auth/sign-up',
},
mail: {
list: '/api/mail/list',
details: '/api/mail/details',
labels: '/api/mail/labels',
},
post: {
list: '/api/post/list',
details: '/api/post/details',
latest: '/api/post/latest',
search: '/api/post/search',
},
product: {
list: '/api/product/list',
details: '/api/product/details',
search: '/api/product/search',
},
user: {
list: '/api/user/list',
profile: '/api/user/profile',
update: '/api/user/update',
settings: '/api/user/settings',
details: '/api/user/details',
},
order: {
list: '/api/order/list',
profile: '/api/order/profile',
update: '/api/order/update',
settings: '/api/order/settings',
details: '/api/order/details',
changeStatus: (orderId: string) => `/api/order/changeStatus?orderId=${orderId}`,
},
invoice: {
list: '/api/invoice/list',
profile: '/api/invoice/profile',
update: '/api/invoice/update',
saveInvoice: (invoiceId: string) => `/api/invoice/saveInvoice?invoiceId=${invoiceId}`,
settings: '/api/invoice/settings',
details: '/api/invoice/details',
changeStatus: (invoiceId: string) => `/api/invoice/changeStatus?invoiceId=${invoiceId}`,
search: '/api/invoice/search',
},
};

View File

@@ -0,0 +1,19 @@
import type { FirebaseApp } from 'firebase/app';
import type { Auth as AuthType } from 'firebase/auth';
import type { Firestore as FirestoreType } from 'firebase/firestore';
import { getAuth } from 'firebase/auth';
import { initializeApp } from 'firebase/app';
import { getFirestore } from 'firebase/firestore';
import { CONFIG } from 'src/global-config';
// ----------------------------------------------------------------------
const isFirebase = CONFIG.auth.method === 'firebase';
export const firebaseApp = isFirebase ? initializeApp(CONFIG.firebase) : ({} as FirebaseApp);
export const AUTH = isFirebase ? getAuth(firebaseApp) : ({} as AuthType);
export const FIRESTORE = isFirebase ? getFirestore(firebaseApp) : ({} as FirestoreType);

View File

@@ -0,0 +1,16 @@
import type { SupabaseClient } from '@supabase/supabase-js';
import { createClient } from '@supabase/supabase-js';
import { CONFIG } from 'src/global-config';
// ----------------------------------------------------------------------
const isSupabase = CONFIG.auth.method === 'supabase';
const supabaseUrl = CONFIG.supabase.url;
const supabaseKey = CONFIG.supabase.key;
export const supabase = isSupabase
? createClient(supabaseUrl, supabaseKey)
: ({} as SupabaseClient<any, 'public', any>);

Submodule 03_source/ionic-react-conference-app deleted from 616068e5eb

View File

@@ -0,0 +1,84 @@
import type { AxiosRequestConfig } from 'axios';
import axios from 'axios';
import { CONFIG } from '../global-config';
// import { CONFIG } from 'src/global-config';
// ----------------------------------------------------------------------
const axiosInstance = axios.create({ baseURL: CONFIG.serverUrl });
axiosInstance.interceptors.response.use(
(response) => response,
(error) => Promise.reject((error.response && error.response.data) || 'Something went wrong!')
);
export default axiosInstance;
// ----------------------------------------------------------------------
export const fetcher = async (args: string | [string, AxiosRequestConfig]) => {
try {
const [url, config] = Array.isArray(args) ? args : [args];
const res = await axiosInstance.get(url, { ...config });
return res.data;
} catch (error) {
console.error('Failed to fetch:', error);
throw error;
}
};
// ----------------------------------------------------------------------
export const endpoints = {
chat: '/api/chat',
kanban: '/api/kanban',
calendar: '/api/calendar',
auth: {
me: '/api/auth/me',
signIn: 'http://localhost:7272/api/auth/sign-in',
signUp: '/api/auth/sign-up',
},
mail: {
list: '/api/mail/list',
details: '/api/mail/details',
labels: '/api/mail/labels',
},
post: {
list: '/api/post/list',
details: '/api/post/details',
latest: '/api/post/latest',
search: '/api/post/search',
},
product: {
list: '/api/product/list',
details: '/api/product/details',
search: '/api/product/search',
},
user: {
list: '/api/user/list',
profile: '/api/user/profile',
update: '/api/user/update',
settings: '/api/user/settings',
details: '/api/user/details',
},
order: {
list: '/api/order/list',
profile: '/api/order/profile',
update: '/api/order/update',
settings: '/api/order/settings',
details: '/api/order/details',
changeStatus: (orderId: string) => `/api/order/changeStatus?orderId=${orderId}`,
},
invoice: {
list: '/api/invoice/list',
profile: '/api/invoice/profile',
update: '/api/invoice/update',
saveInvoice: (invoiceId: string) => `/api/invoice/saveInvoice?invoiceId=${invoiceId}`,
settings: '/api/invoice/settings',
details: '/api/invoice/details',
changeStatus: (invoiceId: string) => `/api/invoice/changeStatus?invoiceId=${invoiceId}`,
search: '/api/invoice/search',
},
};