create-ern-boilerplate 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/default_draft/README.md +3 -0
- package/templates/{simple/app/(admin)/profile.tsx → default_draft/app/(admin)/draft_profile.tsx} +5 -5
- package/templates/{simple/app/(admin)/user-management.tsx → default_draft/app/(admin)/draft_userManagement.tsx} +4 -4
- package/templates/{simple → default_draft}/app/(auth)/_layout.tsx +2 -2
- package/templates/{simple/app/(auth)/login.tsx → default_draft/app/(auth)/draft_login.tsx} +5 -5
- package/templates/{simple/app/(auth)/register.tsx → default_draft/app/(auth)/draft_register.tsx} +4 -4
- package/templates/{simple → default_draft}/app/(protected)/_layout.tsx +5 -5
- package/templates/{simple/app/(protected)/home.tsx → default_draft/app/(protected)/draft_home.tsx} +4 -4
- package/templates/{simple/app/(protected)/settings.tsx → default_draft/app/(protected)/draft_settings.tsx} +6 -6
- package/templates/{simple → default_draft}/app/_layout.tsx +2 -2
- package/templates/{simple → default_draft}/src/components/auth/ProtectedRoute.tsx +2 -2
- package/templates/{simple → default_draft}/src/components/common/Card.tsx +1 -1
- package/templates/{simple → default_draft}/src/components/common/Input.tsx +1 -1
- package/templates/{simple → default_draft}/src/components/common/Loading.tsx +1 -1
- package/templates/{simple → default_draft}/src/components/users/FilterModal.tsx +1 -1
- package/templates/{simple → default_draft}/src/components/users/UserCard.tsx +1 -1
- package/templates/{simple → default_draft}/src/components/users/UserFormModal.tsx +1 -1
- package/templates/{simple/src/contexts/AuthContext.tsx → default_draft/src/contexts/draft_AuthContext.tsx} +6 -6
- package/templates/{simple/src/contexts/ThemeContext.tsx → default_draft/src/contexts/draft_ThemeContext.tsx} +2 -2
- package/templates/{simple/src/hooks/useAuth.ts → default_draft/src/hooks/draft_useAuth.ts} +1 -1
- package/templates/{simple/src/hooks/useTheme.ts → default_draft/src/hooks/draft_useTheme.ts} +1 -1
- package/templates/{simple/src/hooks/useUsers.ts → default_draft/src/hooks/draft_useUsers.ts} +2 -2
- package/templates/{simple/src/services/api.ts → default_draft/src/services/draft_api.ts} +3 -3
- package/templates/{simple/src/services/authService.ts → default_draft/src/services/draft_authService.ts} +3 -3
- package/templates/{simple/src/services/productService.ts → default_draft/src/services/draft_productService.ts} +3 -3
- package/templates/{simple/src/services/userService.ts → default_draft/src/services/draft_userService.ts} +3 -3
- package/templates/{simple/src/services/mockApi/auth.mock.ts → default_draft/src/services/mockApi/draft_auth.mock.ts} +1 -1
- package/templates/{simple/src/services/mockApi/categories.mock.ts → default_draft/src/services/mockApi/draft_categories.mock.ts} +1 -1
- package/templates/{simple/src/services/mockApi/products.mock.ts → default_draft/src/services/mockApi/draft_products.mock.ts} +1 -1
- package/templates/{simple/src/services/mockApi/users.mock.ts → default_draft/src/services/mockApi/draft_users.mock.ts} +2 -2
- package/templates/{simple → default_draft}/src/services/mockApi/index.ts +4 -4
- package/templates/{simple/src/utils/validation.ts → default_draft/src/utils/draft_validation.ts} +1 -1
- package/templates/simple/PROJECT_CONTEXT.MD +0 -663
- package/templates/simple/README.md +0 -274
- /package/templates/{simple → default_draft}/app.json +0 -0
- /package/templates/{simple → default_draft}/babel.config.js +0 -0
- /package/templates/{simple → default_draft}/global.css +0 -0
- /package/templates/{simple → default_draft}/metro.config.js +0 -0
- /package/templates/{simple → default_draft}/nativewind-env.d.ts +0 -0
- /package/templates/{simple → default_draft}/package.json +0 -0
- /package/templates/{simple → default_draft}/server/db.json +0 -0
- /package/templates/{simple → default_draft}/src/assets/images/adaptive-icon.png +0 -0
- /package/templates/{simple → default_draft}/src/assets/images/favicon.png +0 -0
- /package/templates/{simple → default_draft}/src/assets/images/icon.png +0 -0
- /package/templates/{simple → default_draft}/src/assets/images/splash-icon.png +0 -0
- /package/templates/{simple → default_draft}/src/components/common/Button.tsx +0 -0
- /package/templates/{simple → default_draft}/src/components/config/ToastConfig.tsx +0 -0
- /package/templates/{simple/src/components/header/AppHeader.tsx → default_draft/src/components/header/draft_AppHeader.tsx} +0 -0
- /package/templates/{simple → default_draft}/src/components/shared/ConfirmDialog.tsx +0 -0
- /package/templates/{simple → default_draft}/src/components/shared/FormInput.tsx +0 -0
- /package/templates/{simple → default_draft}/src/components/shared/LucideIcon.tsx +0 -0
- /package/templates/{simple → default_draft}/src/components/shared/RoleSelector.tsx +0 -0
- /package/templates/{simple → default_draft}/src/components/users/EmptyState.tsx +0 -0
- /package/templates/{simple → default_draft}/src/components/users/ErrorState.tsx +0 -0
- /package/templates/{simple/src/theme/colors.ts → default_draft/src/theme/draft_colors.ts} +0 -0
- /package/templates/{simple/src/types/api.types.ts → default_draft/src/types/draft_api.types.ts} +0 -0
- /package/templates/{simple/src/types/auth.types.ts → default_draft/src/types/draft_auth.types.ts} +0 -0
- /package/templates/{simple/src/types/product.types.ts → default_draft/src/types/draft_product.types.ts} +0 -0
- /package/templates/{simple/src/types/user.types.ts → default_draft/src/types/draft_user.types.ts} +0 -0
- /package/templates/{simple/src/utils/constants.ts → default_draft/src/utils/draft_constants.ts} +0 -0
- /package/templates/{simple/src/utils/storage.ts → default_draft/src/utils/draft_storage.ts} +0 -0
- /package/templates/{simple → default_draft}/tailwind.config.js +0 -0
- /package/templates/{simple → default_draft}/tsconfig.json +0 -0
package/package.json
CHANGED
package/templates/{simple/app/(admin)/profile.tsx → default_draft/app/(admin)/draft_profile.tsx}
RENAMED
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
Image,
|
|
12
12
|
} from 'react-native';
|
|
13
13
|
import { User, Mail, Phone, MapPin, Calendar, Edit2, Save, X } from 'lucide-react-native';
|
|
14
|
-
import { useTheme } from '@/hooks/
|
|
15
|
-
import { useAuth } from '@/hooks/
|
|
16
|
-
import { useUsers } from '@/hooks/
|
|
14
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
15
|
+
import { useAuth } from '@/hooks/draft_useAuth';
|
|
16
|
+
import { useUsers } from '@/hooks/draft_useUsers';
|
|
17
17
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
18
|
-
import { AppHeader } from '@/components/header/
|
|
18
|
+
import { AppHeader } from '@/components/header/draft_AppHeader';
|
|
19
19
|
import { useRouter } from 'expo-router';
|
|
20
|
-
import { UpdateUserInput } from '@/types/
|
|
20
|
+
import { UpdateUserInput } from '@/types/draft_user.types';
|
|
21
21
|
|
|
22
22
|
export default function ProfileScreen() {
|
|
23
23
|
const { colors } = useTheme();
|
|
@@ -12,15 +12,15 @@ import {
|
|
|
12
12
|
FlatList,
|
|
13
13
|
} from 'react-native';
|
|
14
14
|
import { Search, UserPlus, Filter, X } from 'lucide-react-native';
|
|
15
|
-
import { useTheme } from '
|
|
16
|
-
import { CreateUserInput, UpdateUserInput } from '@/types/
|
|
15
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
16
|
+
import { CreateUserInput, UpdateUserInput } from '@/types/draft_user.types';
|
|
17
17
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
18
|
-
import { AppHeader } from '@/components/header/
|
|
18
|
+
import { AppHeader } from '@/components/header/draft_AppHeader';
|
|
19
19
|
import { useRouter } from 'expo-router';
|
|
20
20
|
import Toast from 'react-native-toast-message';
|
|
21
21
|
|
|
22
22
|
// Custom Hook
|
|
23
|
-
import { useUsers } from '@/hooks/
|
|
23
|
+
import { useUsers } from '@/hooks/draft_useUsers';
|
|
24
24
|
|
|
25
25
|
// Components
|
|
26
26
|
import { UserCard } from '@/components/users/UserCard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Slot, useRouter } from 'expo-router';
|
|
2
2
|
import { useContext, useEffect } from 'react';
|
|
3
3
|
import { View, ActivityIndicator } from 'react-native';
|
|
4
|
-
import { AuthContext } from '@/contexts/
|
|
4
|
+
import { AuthContext } from '@/contexts/draft_AuthContext';
|
|
5
5
|
|
|
6
6
|
export default function AuthLayout() {
|
|
7
7
|
const { isAuthenticated, isLoading } = useContext(AuthContext);
|
|
@@ -9,7 +9,7 @@ export default function AuthLayout() {
|
|
|
9
9
|
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (!isLoading && isAuthenticated) {
|
|
12
|
-
router.replace('/(protected)/
|
|
12
|
+
router.replace('/(protected)/draft_home'); // atau '/(tabs)' kalau kamu pakai tab navigation
|
|
13
13
|
}
|
|
14
14
|
}, [isLoading, isAuthenticated]);
|
|
15
15
|
|
|
@@ -16,12 +16,12 @@ import { Link } from 'expo-router';
|
|
|
16
16
|
import { Mail, Lock, Eye, EyeOff, LogIn, Sparkles, TentTree, Biohazard, Fingerprint } from 'lucide-react-native';
|
|
17
17
|
import * as LocalAuthentication from 'expo-local-authentication';
|
|
18
18
|
import * as SecureStore from 'expo-secure-store';
|
|
19
|
-
import { useAuth } from '@/hooks/
|
|
20
|
-
import { useTheme } from '@/hooks/
|
|
19
|
+
import { useAuth } from '@/hooks/draft_useAuth';
|
|
20
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
21
21
|
import { Button } from '@/components/common/Button';
|
|
22
|
-
import {
|
|
23
|
-
import { APP_CONFIG } from '@/utils/constants';
|
|
22
|
+
import { APP_CONFIG } from '@/utils/draft_constants';
|
|
24
23
|
import Toast from 'react-native-toast-message';
|
|
24
|
+
import { validation } from '@/utils/draft_validation';
|
|
25
25
|
|
|
26
26
|
const { width, height } = Dimensions.get('window');
|
|
27
27
|
|
|
@@ -525,7 +525,7 @@ export default function LoginScreen() {
|
|
|
525
525
|
<Text style={[styles.signUpText, { color: colors.textSecondary }]}>
|
|
526
526
|
Don't have an account?{' '}
|
|
527
527
|
</Text>
|
|
528
|
-
<Link href="/(auth)/
|
|
528
|
+
<Link href="/(auth)/draft_register" asChild>
|
|
529
529
|
<TouchableOpacity activeOpacity={0.7}>
|
|
530
530
|
<Text style={[styles.signUpLink, { color: colors.primary }]}>
|
|
531
531
|
Sign Up
|
package/templates/{simple/app/(auth)/register.tsx → default_draft/app/(auth)/draft_register.tsx}
RENAMED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
} from 'react-native';
|
|
15
15
|
import { Link } from 'expo-router';
|
|
16
16
|
import { User, Mail, Lock, Eye, EyeOff, UserPlus, Sparkles, CheckCircle2 } from 'lucide-react-native';
|
|
17
|
-
import { useAuth } from '@/hooks/
|
|
18
|
-
import { useTheme } from '@/hooks/
|
|
17
|
+
import { useAuth } from '@/hooks/draft_useAuth';
|
|
18
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
19
19
|
import { Button } from '@/components/common/Button';
|
|
20
|
-
import { validation } from '@/utils/
|
|
20
|
+
import { validation } from '@/utils/draft_validation';
|
|
21
21
|
|
|
22
22
|
const { width, height } = Dimensions.get('window');
|
|
23
23
|
|
|
@@ -340,7 +340,7 @@ export default function RegisterScreen() {
|
|
|
340
340
|
<Text style={[styles.signInText, { color: colors.textSecondary }]}>
|
|
341
341
|
Already have an account?{' '}
|
|
342
342
|
</Text>
|
|
343
|
-
<Link href="/(auth)/
|
|
343
|
+
<Link href="/(auth)/draft_register" asChild>
|
|
344
344
|
<TouchableOpacity activeOpacity={0.7}>
|
|
345
345
|
<Text style={[styles.signInLink, { color: colors.primary }]}>
|
|
346
346
|
Sign In
|
|
@@ -3,8 +3,8 @@ import { View, Text, TouchableOpacity, StyleSheet, Platform } from 'react-native
|
|
|
3
3
|
import { Tabs, Redirect } from 'expo-router';
|
|
4
4
|
import { Home, User, Settings } from 'lucide-react-native';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
-
import { useTheme } from '@/hooks/
|
|
7
|
-
import { useAuth } from '@/hooks/
|
|
6
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
7
|
+
import { useAuth } from '@/hooks/draft_useAuth';
|
|
8
8
|
|
|
9
9
|
export default function MainLayout() {
|
|
10
10
|
const { colors } = useTheme();
|
|
@@ -13,7 +13,7 @@ export default function MainLayout() {
|
|
|
13
13
|
|
|
14
14
|
// Redirect to login if not authenticated
|
|
15
15
|
if (!isAuthenticated) {
|
|
16
|
-
return <Redirect href="/(auth)/
|
|
16
|
+
return <Redirect href="/(auth)/draft_login" />;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Check if user is admin
|
|
@@ -48,7 +48,7 @@ export default function MainLayout() {
|
|
|
48
48
|
}}
|
|
49
49
|
>
|
|
50
50
|
<Tabs.Screen
|
|
51
|
-
name="
|
|
51
|
+
name="draft_home"
|
|
52
52
|
options={{
|
|
53
53
|
title: 'Home',
|
|
54
54
|
tabBarIcon: ({ color, focused }) => (
|
|
@@ -63,7 +63,7 @@ export default function MainLayout() {
|
|
|
63
63
|
/>
|
|
64
64
|
|
|
65
65
|
<Tabs.Screen
|
|
66
|
-
name="
|
|
66
|
+
name="draft_settings"
|
|
67
67
|
options={{
|
|
68
68
|
title: 'Settings',
|
|
69
69
|
tabBarIcon: ({ color, focused }) => (
|
package/templates/{simple/app/(protected)/home.tsx → default_draft/app/(protected)/draft_home.tsx}
RENAMED
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
ActivityIndicator,
|
|
9
9
|
Dimensions,
|
|
10
10
|
} from 'react-native';
|
|
11
|
-
import { useTheme } from '@/hooks/
|
|
12
|
-
import { useAuth } from '@/hooks/
|
|
11
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
12
|
+
import { useAuth } from '@/hooks/draft_useAuth';
|
|
13
13
|
import { useRouter } from 'expo-router';
|
|
14
14
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
15
|
-
import { AppHeader } from '@/components/header/
|
|
15
|
+
import { AppHeader } from '@/components/header/draft_AppHeader';
|
|
16
16
|
import Toast from 'react-native-toast-message';
|
|
17
17
|
|
|
18
18
|
const { width } = Dimensions.get('window');
|
|
@@ -55,7 +55,7 @@ export default function HomeScreen() {
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
const handleProfilePress = () => {
|
|
58
|
-
router.push('/(protected)/
|
|
58
|
+
router.push('/(protected)/draft_settings');
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
Globe,
|
|
22
22
|
User,
|
|
23
23
|
} from 'lucide-react-native';
|
|
24
|
-
import { useTheme } from '
|
|
25
|
-
import { useAuth } from '
|
|
24
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
25
|
+
import { useAuth } from '@/hooks/draft_useAuth';
|
|
26
26
|
import { useRouter } from 'expo-router';
|
|
27
|
-
import { AppHeader } from '@/components/header/
|
|
27
|
+
import { AppHeader } from '@/components/header/draft_AppHeader';
|
|
28
28
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
29
29
|
|
|
30
30
|
export default function SettingsScreen() {
|
|
@@ -49,7 +49,7 @@ export default function SettingsScreen() {
|
|
|
49
49
|
style: 'destructive',
|
|
50
50
|
onPress: async () => {
|
|
51
51
|
await logout();
|
|
52
|
-
router.replace('/(auth)/
|
|
52
|
+
router.replace('/(auth)/draft_login');
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
55
|
]
|
|
@@ -133,7 +133,7 @@ export default function SettingsScreen() {
|
|
|
133
133
|
icon={User}
|
|
134
134
|
title="My Profile"
|
|
135
135
|
subtitle="Manage your personal information"
|
|
136
|
-
onPress={() => router.push('/(admin)/
|
|
136
|
+
onPress={() => router.push('/(admin)/draft_profile')}
|
|
137
137
|
/>
|
|
138
138
|
</SettingSection>
|
|
139
139
|
|
|
@@ -202,7 +202,7 @@ export default function SettingsScreen() {
|
|
|
202
202
|
icon={Users}
|
|
203
203
|
title="User Management"
|
|
204
204
|
subtitle="Manage users and permissions"
|
|
205
|
-
onPress={() => router.push('/(admin)/
|
|
205
|
+
onPress={() => router.push('/(admin)/draft_userManagement')}
|
|
206
206
|
/>
|
|
207
207
|
<SettingItem
|
|
208
208
|
icon={Globe}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Stack } from 'expo-router';
|
|
2
|
-
import { AuthProvider } from '@/contexts/
|
|
3
|
-
import { ThemeProvider } from '
|
|
2
|
+
import { AuthProvider } from '@/contexts/draft_AuthContext';
|
|
3
|
+
import { ThemeProvider } from '@/contexts/draft_ThemeContext';
|
|
4
4
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
5
|
import '../global.css';
|
|
6
6
|
import Toast from 'react-native-toast-message';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { View, Text, StyleSheet, ActivityIndicator } from 'react-native';
|
|
4
4
|
import { Redirect } from 'expo-router';
|
|
5
|
-
import { useAuth } from '@/hooks/
|
|
6
|
-
import { useTheme } from '@/hooks/
|
|
5
|
+
import { useAuth } from '@/hooks/draft_useAuth';
|
|
6
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
7
7
|
import { ShieldAlert } from 'lucide-react-native';
|
|
8
8
|
|
|
9
9
|
interface ProtectedRouteProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { View, TextInput, Text, TouchableOpacity, TextInputProps } from 'react-native';
|
|
3
|
-
import { useTheme } from '
|
|
3
|
+
import { useTheme } from '@/hooks/draft_useTheme';
|
|
4
4
|
|
|
5
5
|
interface InputProps extends TextInputProps {
|
|
6
6
|
label?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { View, Text, Modal, TouchableOpacity, StyleSheet } from 'react-native';
|
|
4
4
|
import { X } from 'lucide-react-native';
|
|
5
|
-
import { UserFilters } from '@/types/
|
|
5
|
+
import { UserFilters } from '@/types/draft_user.types';
|
|
6
6
|
|
|
7
7
|
interface FilterModalProps {
|
|
8
8
|
visible: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { View, Text, TouchableOpacity, StyleSheet, Image } from 'react-native';
|
|
4
4
|
import { MoreVertical, Edit2, Shield, Trash2 } from 'lucide-react-native';
|
|
5
|
-
import { UserData } from '@/types/
|
|
5
|
+
import { UserData } from '@/types/draft_user.types';
|
|
6
6
|
|
|
7
7
|
interface UserCardProps {
|
|
8
8
|
user: UserData;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import { View, Text, Modal, TouchableOpacity, StyleSheet, ActivityIndicator } from 'react-native';
|
|
4
4
|
import { X } from 'lucide-react-native';
|
|
5
|
-
import { CreateUserInput, UpdateUserInput } from '@/types/
|
|
5
|
+
import { CreateUserInput, UpdateUserInput } from '@/types/draft_user.types';
|
|
6
6
|
import Toast from 'react-native-toast-message';
|
|
7
7
|
import { FormInput } from '@/components/shared/FormInput';
|
|
8
8
|
import { RoleSelector } from '@/components/shared/RoleSelector';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { createContext, useState, useEffect, ReactNode } from 'react';
|
|
2
2
|
import { router } from 'expo-router';
|
|
3
|
-
import { authService } from '
|
|
4
|
-
import { storage } from '
|
|
5
|
-
import { User, LoginCredentials, RegisterData } from '@/types/
|
|
3
|
+
import { authService } from '@/services/draft_authService';
|
|
4
|
+
import { storage } from '@/utils/draft_storage';
|
|
5
|
+
import { User, LoginCredentials, RegisterData } from '@/types/draft_auth.types';
|
|
6
6
|
|
|
7
7
|
interface AuthContextType {
|
|
8
8
|
user: User | null;
|
|
@@ -49,7 +49,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|
|
49
49
|
const response = await authService.login(credentials);
|
|
50
50
|
await storage.setToken(response.token);
|
|
51
51
|
setUser(response.user);
|
|
52
|
-
router.replace('/(protected)/
|
|
52
|
+
router.replace('/(protected)/draft_home');
|
|
53
53
|
} catch (error) {
|
|
54
54
|
throw error;
|
|
55
55
|
}
|
|
@@ -60,7 +60,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|
|
60
60
|
const response = await authService.register(data);
|
|
61
61
|
await storage.setToken(response.token);
|
|
62
62
|
setUser(response.user);
|
|
63
|
-
router.replace('/(protected)/
|
|
63
|
+
router.replace('/(protected)/draft_home');
|
|
64
64
|
} catch (error) {
|
|
65
65
|
throw error;
|
|
66
66
|
}
|
|
@@ -70,7 +70,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
|
|
70
70
|
try {
|
|
71
71
|
await storage.removeToken();
|
|
72
72
|
setUser(null);
|
|
73
|
-
router.replace('/(auth)/
|
|
73
|
+
router.replace('/(auth)/draft_login');
|
|
74
74
|
} catch (error) {
|
|
75
75
|
console.error('Error logging out:', error);
|
|
76
76
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { createContext, useState, useEffect, ReactNode } from 'react';
|
|
2
2
|
import { useColorScheme } from 'react-native';
|
|
3
|
-
import { storage } from '@/utils/
|
|
4
|
-
import { colors } from '@/theme/
|
|
3
|
+
import { storage } from '@/utils/draft_storage';
|
|
4
|
+
import { colors } from '@/theme/draft_colors';
|
|
5
5
|
|
|
6
6
|
type ThemeMode = 'light' | 'dark' | 'auto';
|
|
7
7
|
|
package/templates/{simple/src/hooks/useUsers.ts → default_draft/src/hooks/draft_useUsers.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// hooks/useUsers.ts
|
|
2
2
|
import { useState, useEffect, useCallback } from 'react';
|
|
3
|
-
import { userService } from '@/services/
|
|
4
|
-
import { CreateUserInput, UpdateUserInput, UserData, UserFilters } from '@/types/
|
|
3
|
+
import { userService } from '@/services/draft_userService';
|
|
4
|
+
import { CreateUserInput, UpdateUserInput, UserData, UserFilters } from '@/types/draft_user.types';
|
|
5
5
|
import Toast from 'react-native-toast-message';
|
|
6
6
|
|
|
7
7
|
const ITEMS_PER_PAGE = 10;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios, { AxiosInstance, AxiosError, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
-
import { API_CONFIG, ERROR_MESSAGES } from '
|
|
3
|
-
import { storage } from '
|
|
4
|
-
import { ApiError } from '@/types/
|
|
2
|
+
import { API_CONFIG, ERROR_MESSAGES } from '@/utils/draft_constants';
|
|
3
|
+
import { storage } from '@/utils/draft_storage';
|
|
4
|
+
import { ApiError } from '@/types/draft_api.types';
|
|
5
5
|
|
|
6
6
|
class ApiService {
|
|
7
7
|
private api: AxiosInstance;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { api } from './
|
|
2
|
-
import { LoginCredentials, RegisterData, AuthResponse, User } from '@/types/
|
|
3
|
-
import { API_CONFIG } from '
|
|
1
|
+
import { api } from './draft_api';
|
|
2
|
+
import { LoginCredentials, RegisterData, AuthResponse, User } from '@/types/draft_auth.types';
|
|
3
|
+
import { API_CONFIG } from '@/utils/draft_constants';
|
|
4
4
|
import { mockApi } from './mockApi';
|
|
5
5
|
|
|
6
6
|
class AuthService {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { api } from './
|
|
1
|
+
import { api } from './draft_api';
|
|
2
2
|
import { mockApi } from './mockApi';
|
|
3
|
-
import { API_CONFIG } from '
|
|
4
|
-
import { Product, ProductWithCategory, Category, CreateProductData, UpdateProductData } from '@/types/
|
|
3
|
+
import { API_CONFIG } from '@/utils/draft_constants';
|
|
4
|
+
import { Product, ProductWithCategory, Category, CreateProductData, UpdateProductData } from '@/types/draft_product.types';
|
|
5
5
|
|
|
6
6
|
interface ProductQueryParams {
|
|
7
7
|
search?: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { api } from './
|
|
1
|
+
import { api } from './draft_api';
|
|
2
2
|
// import { mockApi } from './mockApi';
|
|
3
|
-
import { API_CONFIG } from '
|
|
3
|
+
import { API_CONFIG } from '@/utils/draft_constants';
|
|
4
4
|
import {
|
|
5
5
|
UserData,
|
|
6
6
|
CreateUserInput,
|
|
7
7
|
UpdateUserInput,
|
|
8
8
|
UserFilters
|
|
9
|
-
} from '@/types/
|
|
9
|
+
} from '@/types/draft_user.types';
|
|
10
10
|
import { mockApi } from './mockApi';
|
|
11
11
|
|
|
12
12
|
class UserService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// products.mock.ts
|
|
2
|
-
import { CreateProductData, Product, ProductFilters, UpdateProductData } from '@/types/
|
|
2
|
+
import { CreateProductData, Product, ProductFilters, UpdateProductData } from '@/types/draft_product.types';
|
|
3
3
|
import * as db from 'server/db.json';
|
|
4
4
|
|
|
5
5
|
let products: Product[] = [...db.products];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { User } from '@/types/
|
|
2
|
-
import { CreateUserInput, UpdateUserInput, UserFilters } from '@/types/
|
|
1
|
+
import { User } from '@/types/draft_auth.types';
|
|
2
|
+
import { CreateUserInput, UpdateUserInput, UserFilters } from '@/types/draft_user.types';
|
|
3
3
|
import * as db from 'server/db.json';
|
|
4
4
|
|
|
5
5
|
let users: User[] = [...db.users];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as authHandlers from './
|
|
2
|
-
import * as userHandlers from './
|
|
3
|
-
import * as productHandlers from './
|
|
4
|
-
import * as categoryHandlers from './
|
|
1
|
+
import * as authHandlers from './draft_auth.mock';
|
|
2
|
+
import * as userHandlers from './draft_users.mock';
|
|
3
|
+
import * as productHandlers from './draft_products.mock';
|
|
4
|
+
import * as categoryHandlers from './draft_categories.mock';
|
|
5
5
|
|
|
6
6
|
const delay = (ms = 150) => new Promise(r => setTimeout(r, ms));
|
|
7
7
|
|