angular-generate 2.2.9 → 2.3.1
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.
|
@@ -25,7 +25,7 @@ ng add @ng-bootstrap/ng-bootstrap --force --skip-confirmation || npm install @ng
|
|
|
25
25
|
echo "📦 Installation de Bootstrap et Bootstrap Icons..."
|
|
26
26
|
npm install bootstrap bootstrap-icons --force
|
|
27
27
|
|
|
28
|
-
# 6. Installer moment
|
|
28
|
+
# 6. Installer moment
|
|
29
29
|
echo "📦 Installation de moment js"
|
|
30
30
|
npm install moment --force
|
|
31
31
|
|
|
@@ -93,4 +93,70 @@ else
|
|
|
93
93
|
echo "⚠️ Attention : Fichier $CONFIG_FILE introuvable. Pense à ajouter provideHttpClient manuellement."
|
|
94
94
|
fi
|
|
95
95
|
|
|
96
|
-
echo "
|
|
96
|
+
echo "🛣️ Configuration des routes dans app.routes.ts..."
|
|
97
|
+
|
|
98
|
+
ROUTES_FILE="src/app/app.routes.ts"
|
|
99
|
+
|
|
100
|
+
# Création du dossier app si nécessaire et écriture du fichier app.routes.ts
|
|
101
|
+
mkdir -p "$(dirname "$ROUTES_FILE")"
|
|
102
|
+
|
|
103
|
+
cat << 'EOF' > "$ROUTES_FILE"
|
|
104
|
+
import { Routes } from '@angular/router';
|
|
105
|
+
import { HomeComponent } from './home/home/home.component';
|
|
106
|
+
import { PublicComponent } from './public/public/public.component';
|
|
107
|
+
import { AuthGuard } from './guard/auth/auth.guard';
|
|
108
|
+
|
|
109
|
+
export const routes: Routes = [
|
|
110
|
+
{
|
|
111
|
+
path: '',
|
|
112
|
+
pathMatch: 'full',
|
|
113
|
+
redirectTo: 'public'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
path: 'home',
|
|
117
|
+
component: HomeComponent,
|
|
118
|
+
canActivate: [AuthGuard],
|
|
119
|
+
children: [
|
|
120
|
+
{
|
|
121
|
+
path: '',
|
|
122
|
+
loadChildren: () =>import('./home/home.module').then((m) => m.HomeModule)
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
path: 'public',
|
|
128
|
+
component: PublicComponent,
|
|
129
|
+
children: [
|
|
130
|
+
{
|
|
131
|
+
path: '',
|
|
132
|
+
loadChildren: () =>import('./public/public.module').then((m) => m.PublicModule)
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
];
|
|
137
|
+
EOF
|
|
138
|
+
|
|
139
|
+
echo "✅ Fichier $ROUTES_FILE généré avec succès !"
|
|
140
|
+
|
|
141
|
+
echo "📄 Mise à jour de app.component.html..."
|
|
142
|
+
|
|
143
|
+
# Détection de app.component.html (peut être .html ou .html dans src/app/)
|
|
144
|
+
APP_HTML=""
|
|
145
|
+
if [ -f "src/app/app.html" ]; then
|
|
146
|
+
APP_HTML="src/app/app.html"
|
|
147
|
+
elif [ -f "src/app/app.ts" ]; then
|
|
148
|
+
# Au cas où le composant est standalone avec template inline, on crée le fichier .html s'il n'existe pas
|
|
149
|
+
APP_HTML="src/app/app.html"
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
if [ -n "$APP_HTML" ]; then
|
|
153
|
+
echo "<router-outlet />" > "$APP_HTML"
|
|
154
|
+
echo "✅ Contenu de $APP_HTML remplacé par <router-outlet />"
|
|
155
|
+
else
|
|
156
|
+
echo "⚠️ Fichier app.html introuvable, création..."
|
|
157
|
+
echo "<router-outlet />" > "src/app/app.html"
|
|
158
|
+
echo "✅ src/app/app.html créé avec <router-outlet />"
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
echo "🎉 Installation et configuration globale terminées !"
|
package/package.json
CHANGED
|
@@ -114,7 +114,7 @@ export class ${componentName_class}Component implements OnInit, OnDestroy {
|
|
|
114
114
|
if (reponse && reponse.success) {
|
|
115
115
|
console.log("Opération effectuée avec succés sur la table login. Réponse= ", reponse);
|
|
116
116
|
this.onReset_login_login();
|
|
117
|
-
await this.api.save_on_local_storage("token", reponse);
|
|
117
|
+
await this.api.save_on_local_storage("token", reponse.data);
|
|
118
118
|
|
|
119
119
|
await this.api.update_data_from_token();
|
|
120
120
|
this.api.Swal_success(reponse.message || "Opération éffectuée avec succés");
|