Projet SupFile version final

This commit is contained in:
Tmadkaud 2018-06-25 18:44:24 +02:00
parent 599dad6313
commit 5c2fbcb806
5 changed files with 35 additions and 3 deletions

View File

@ -123,6 +123,20 @@ router.post('/deleteFileMongo', function(req, res, next) {
}); });
}); });
/* DELETE FILE */
router.post('/deleteUserMongo', function(req, res, next) {
console.log(JSON.stringify(req.body));
User.remove({_id : req.body._id, name: req.body.name}, function (err, post) {
if (err){
return next(err);
}
res.json(post);
});
});
/* DELETE FOLDER */ /* DELETE FOLDER */
router.post('/deleteFolderMongo', function(req, res, next) { router.post('/deleteFolderMongo', function(req, res, next) {
FolderMongo.remove({_id : req.body._id, name: req.body.name, owner: req.body.owner}, function (err, post) { FolderMongo.remove({_id : req.body._id, name: req.body.name, owner: req.body.owner}, function (err, post) {

View File

@ -172,7 +172,7 @@
</button> </button>
<h4 class="modal-title w-100" id="myModalLabel">Preview</h4> <h4 class="modal-title w-100" id="myModalLabel">Preview</h4>
</div> </div>
<div class="modal-body img-fluid text-center"> <div class="modal-body img-fluid text-center" style="display: flex; align-items: center; justify-content: center;">
<div *ngIf="file.type === ('image/jpeg')"> <div *ngIf="file.type === ('image/jpeg')">
<img [src]=file.urlSafe class="img-fluid" width="350" height="200"> <img [src]=file.urlSafe class="img-fluid" width="350" height="200">
</div> </div>

View File

@ -193,6 +193,12 @@ export class BookComponent implements OnInit, OnDestroy {
}); });
} }
deleteUserMongo() {
this.http.post('/api/deleteUserMongo', this.currentUser).subscribe(user => {
console.log('User is delete');
});
}
deleteFolder(folderToDelete) { deleteFolder(folderToDelete) {
this.http.post('/api/deleteFolderMongo', folderToDelete).subscribe(folder => { this.http.post('/api/deleteFolderMongo', folderToDelete).subscribe(folder => {
this.openFolder(this.mainFolder.path); this.openFolder(this.mainFolder.path);

View File

@ -92,8 +92,14 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link waves-light" mdbWavesEffect><i class="fa fa-user"></i> <span class="clearfix d-none d-sm-inline-block"> {{currentUser.username}} </span></a> <a class="nav-link waves-light" mdbWavesEffect><i class="fa fa-user"></i> <span class="clearfix d-none d-sm-inline-block"> {{currentUser.username}} </span></a>
</li> </li>
<li class="nav-item" (click)="logout()"> <li class="nav-item dropdown" dropdown>
<a class="nav-link waves-light" mdbWavesEffect><i class="fa fa-sign-out mr-1"></i> <span class="clearfix d-none d-sm-inline-block">Log out</span></a> <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
Profil<span class="caret"></span></a>
<div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
<a class="nav-link waves-light" mdbWavesEffect (click)="logout()"><i class="fa fa-sign-out mr-1"></i><span class="clearfix d-none d-sm-inline-block">Log out</span></a>
<div class="divider dropdown-divider"></div>
<a class="dropdown-item waves-light" mdbWavesEffect (click)="deleteUserMongo()">Unsubscribe</a>
</div>
</li> </li>
</ul> </ul>
</navlinks> </navlinks>

View File

@ -52,6 +52,12 @@ export class MainComponent implements OnInit {
} }
deleteUserMongo() {
this.http.post('/api/deleteUserMongo', this.currentUser).subscribe(user => {
console.log('User is delete');
this.logout();
});
}
getItems(path) { getItems(path) {
var test = []; var test = [];