forked from tykayn/funky-framadate-front
⚡ fix some deps
This commit is contained in:
parent
cb6636f155
commit
cf4e9f4563
@ -4,6 +4,7 @@
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"serve": "ng serve",
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
|
@ -1,6 +1,5 @@
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
import {AppRoutingModule} from './app-routing.module';
|
||||
import {AppComponent} from './app.component';
|
||||
import {BaseComponent} from './pages/base-page/base.component';
|
||||
@ -42,6 +41,8 @@ import {PollGraphicComponent} from './poll-graphic/poll-graphic.component';
|
||||
import {AdminComponent} from './pages/admin/admin.component';
|
||||
import {SelectorComponent} from './ui/selector/selector.component';
|
||||
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
|
||||
import {ConfigService} from "./services/config.service";
|
||||
import {PollService} from "./services/poll.service";
|
||||
|
||||
export class MyMissingTranslationHandler implements MissingTranslationHandler {
|
||||
handle(params: MissingTranslationHandlerParams) {
|
||||
@ -104,7 +105,7 @@ export function HttpLoaderFactory(http: HttpClient) {
|
||||
FormsModule,
|
||||
RouterModule.forRoot(Routes)
|
||||
],
|
||||
providers: [TranslateService],
|
||||
providers: [TranslateService, ConfigService, PollService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
|
@ -17,7 +17,7 @@ import {VoteChoiceComponent} from "../vote-choice/vote-choice.component";
|
||||
*/
|
||||
export const Routes =
|
||||
[
|
||||
{path: '', component: CreateOrRetrieveComponent},
|
||||
{path: '', redirectTo: 'step/creation', pathMatch: 'full'},
|
||||
{path: 'home', component: HomeComponent},
|
||||
{path: 'base', component: BaseComponent},
|
||||
{path: 'step/base', component: BaseComponent},
|
||||
@ -32,5 +32,6 @@ export const Routes =
|
||||
{path: 'step/end', component: EndConfirmationComponent},
|
||||
{path: 'graphic/:poll', component: PollGraphicComponent},
|
||||
{path: 'votechoice', component: VoteChoiceComponent},
|
||||
{path: '**', redirectTo: '/home', pathMatch: 'full'},
|
||||
]
|
||||
;
|
||||
|
@ -40,16 +40,17 @@
|
||||
{{"config.find_helper"|translate}} :
|
||||
</label>
|
||||
<input
|
||||
#emailToFind
|
||||
type="email"
|
||||
name="mail"
|
||||
id="email"
|
||||
autofocus="autofocus"
|
||||
#emailToFind
|
||||
type="email"
|
||||
name="mail"
|
||||
id="email"
|
||||
autofocus="autofocus"
|
||||
/>
|
||||
<input
|
||||
type="submit"
|
||||
class="btn btn-block"
|
||||
i18n-value="'config.find_button'|translate"
|
||||
[disabled]="!emailToFind.value"
|
||||
/>
|
||||
</form>
|
||||
</section>
|
||||
@ -57,4 +58,10 @@
|
||||
<ul class="poll-list" *ngFor="let poll of config.myPolls">
|
||||
<li> poll</li>
|
||||
</ul>
|
||||
<div class="loading">
|
||||
<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>
|
||||
</div>
|
||||
<div class="no-polls" *ngIf="!config.loading && (! config.myPolls || !config.myPolls.length)">
|
||||
Aucun sondage.
|
||||
</div>
|
||||
</section>
|
||||
|
@ -10,6 +10,8 @@ import {PollService} from "../../services/poll.service";
|
||||
})
|
||||
export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
|
||||
|
||||
loadedMyPolls: boolean = false;
|
||||
|
||||
constructor(public config: ConfigService,
|
||||
public pollService: PollService) {
|
||||
super(config);
|
||||
@ -20,7 +22,11 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
|
||||
}
|
||||
|
||||
findMyPollsByEmail(email: string) {
|
||||
if (!email) {
|
||||
return
|
||||
}
|
||||
this.config.findPollsByEmail(email);
|
||||
this.loadedMyPolls = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {Component, OnInit} from "@angular/core";
|
||||
import {Component, Inject, OnInit} from "@angular/core";
|
||||
import {Chart} from "chart.js";
|
||||
import {DOCUMENT} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: "framadate-poll-graphic",
|
||||
@ -8,7 +9,6 @@ import {Chart} from "chart.js";
|
||||
})
|
||||
export class PollGraphicComponent implements OnInit {
|
||||
isColorblind: boolean = false;
|
||||
lineChart: Chart;
|
||||
pollData: any;
|
||||
yesList: number[] = [];
|
||||
maybeList: number[] = [];
|
||||
@ -16,7 +16,7 @@ export class PollGraphicComponent implements OnInit {
|
||||
nbPoll: number = 0;
|
||||
dateList: string[] = [];
|
||||
|
||||
constructor() {
|
||||
constructor(@Inject(DOCUMENT) private document: any,) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -76,7 +76,7 @@ export class PollGraphicComponent implements OnInit {
|
||||
this.formatDataAnswers(toto);
|
||||
|
||||
this.isColorblind = false;
|
||||
this.pollData = new Chart(document.getElementById("graph"), {
|
||||
this.pollData = new Chart(this.document.getElementById("graph"), {
|
||||
type: "horizontalBar",
|
||||
data: {
|
||||
labels: ["jeudi"],
|
||||
|
@ -12,6 +12,7 @@ import {environment} from "../../environments/environment";
|
||||
})
|
||||
export class ConfigService extends PollConfig {
|
||||
myEmail: string;
|
||||
loading: boolean = false;
|
||||
baseHref: any = environment.baseApiHref;
|
||||
myPolls: any;// list of retrieved polls from the backend api
|
||||
|
||||
@ -77,16 +78,23 @@ export class ConfigService extends PollConfig {
|
||||
const headerDict = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE',
|
||||
'Access-Control-Allow-Origin': environment.baseApiHref
|
||||
};
|
||||
|
||||
const requestOptions = {
|
||||
headers: new HttpHeaders(headerDict),
|
||||
email: this.myEmail
|
||||
};
|
||||
|
||||
this.http.get(`${this.baseHref}/my-polls`)
|
||||
this.loading = true;
|
||||
this.http.get(`${this.baseHref}/my-polls`,
|
||||
requestOptions,
|
||||
)
|
||||
.subscribe(res => {
|
||||
// message: 'Trouvé! Allez voir votre boite email',
|
||||
this.myPolls = res;
|
||||
this.loading = false;
|
||||
}, this.handleError
|
||||
)
|
||||
}
|
||||
@ -99,6 +107,7 @@ export class ConfigService extends PollConfig {
|
||||
handleError(err: any) {
|
||||
// TODO handle a toast message
|
||||
console.error('err', err)
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +135,7 @@ export class ConfigService extends PollConfig {
|
||||
* @param id
|
||||
*/
|
||||
getPollById(id: string, password: string) {
|
||||
// http://127.0.0.1:8000/
|
||||
|
||||
this.http
|
||||
.get(`${this.baseHref}/poll/${id}`,
|
||||
{params: new HttpParams().set('body', password)})
|
||||
|
@ -1,13 +1,6 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ConfigService} from "./config.service";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {environment} from "../../environments/environment";
|
||||
|
||||
class JsonResponse {
|
||||
message: string;
|
||||
data: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@ -15,9 +8,7 @@ export class PollService {
|
||||
|
||||
private baseHref: string = environment.baseApiHref;
|
||||
|
||||
constructor(private configService: ConfigService,
|
||||
private document: Document,
|
||||
private http: HttpClient) {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
baseApiHref : 'http://127.0.0.1:8000/api/v1/'
|
||||
baseApiHref: 'http://127.0.0.1:8000/api/v1/'
|
||||
};
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
baseApiHref: "http://localhost:8000/api/v1"
|
||||
baseApiHref: "https://framadate-api.cipherbliss.com/api/v1"
|
||||
// baseApiHref: "http://localhost:8000/api/v1"
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user