Commit 1bf37d71 authored by Adarsh's avatar Adarsh

user tokens added to fiel and home

parent 88d8797e
......@@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
import {File} from './file';
import {Observable, of} from 'rxjs';
import {HttpClient} from '@angular/common/http';
import { User } from './user';
@Injectable({
......@@ -11,6 +12,7 @@ export class FileService {
saveUrl = 'http://localhost/sfcode/backend/filesave.php';
uploadUrl = 'http://localhost/sfcode/backend/fileupload.php';
filelistUrl = 'http://localhost/sfcode/backend/list_files.php'
constructor(private http: HttpClient) {
}
......@@ -18,7 +20,6 @@ export class FileService {
getFiles(): Observable<File[]> {
const ret: File[] = [];
const arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
for (const item of arr) {
......
import {Component, OnInit} from '@angular/core';
import {File} from '../file';
import {FileService} from '../file.service';
import { ApiService } from '../api.service';
import { User } from '../user';
@Component({
selector: 'app-file',
......@@ -9,17 +11,19 @@ import {FileService} from '../file.service';
})
export class FileComponent implements OnInit {
user: User;
files: File[];
// File upload variables
shortLink = '';
loading = false; // Flag variable
loading = false;
fileToUpload: File = null;
uploadPopupActive = false;
constructor(private fileService: FileService) {
constructor(private fileService: FileService,
private dataService: ApiService ) {
}
ngOnInit(): void {
this.user = JSON.parse(this.dataService.getToken());
this.getFiles();
}
......
......@@ -12,7 +12,6 @@ import { User } from '../user';
export class HomeComponent implements OnInit {
user: User;
loggedIn: boolean;
problems: Problem[];
constructor(private dataService: ApiService,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment