From 595df9ffcc07af66ba916f32e3e5e8b99ad148ef Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 29 Oct 2019 16:32:39 +0100 Subject: [PATCH] updated actionlist, added dynamic url in environment(.production).ts --- src/app/models/actionlist.ts | 12 ++++++------ src/app/services/chat/chat.service.ts | 3 ++- src/app/services/feed/feed.service.ts | 4 ++-- src/app/services/login/login.service.ts | 3 ++- src/app/services/register/register.service.ts | 3 ++- src/app/services/selfservice/self.service.ts | 7 +++---- src/environments/environment.prod.ts | 3 ++- src/environments/environment.ts | 3 ++- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/app/models/actionlist.ts b/src/app/models/actionlist.ts index 29a2ba7..21f2643 100644 --- a/src/app/models/actionlist.ts +++ b/src/app/models/actionlist.ts @@ -1,15 +1,15 @@ export class Actionlist{ actions: { id: number, name: string, points: number}[] = [ - { id: 0, name: "collect much trash",points: 25}, - { id: 1, name: "collect a bit trash",points: 5 }, - { id: 2, name: "trash seperation", points: 5 }, + { id: 0, name: "collect a lot of trash",points: 25}, + { id: 1, name: "collect a bit of trash",points: 10 }, + { id: 2, name: "do trash seperation", points: 5 }, { id: 3, name: "plant a tree", points: 2 }, - { id: 4, name: "beautify yout surroundings", points: 8 }, + { id: 4, name: "beautify your surroundings", points: 8 }, { id: 5, name: "reduce waste", points: 5 }, { id: 6, name: "reduce CO2 emission", points: 5 }, { id: 7, name: "eat a vegetarian meal", points: 2 }, { id: 8, name: "don't use the car", points: 10 }, - { id: 9, name: "buy fair trade/ local product", points: 1 }, - { id: 10, name: "donate money to an environment organisation ", points: 3 }, + { id: 9, name: "buy a fair trade/ local product", points: 1 }, + { id: 10, name: "donate money to an environment organisation ", points: 10 }, ]; } \ No newline at end of file diff --git a/src/app/services/chat/chat.service.ts b/src/app/services/chat/chat.service.ts index dded0b4..f054989 100644 --- a/src/app/services/chat/chat.service.ts +++ b/src/app/services/chat/chat.service.ts @@ -5,6 +5,7 @@ import { responsePathAsArray } from 'graphql'; import { Chatmessage } from 'src/app/models/chatmessage'; import { FriendInfo } from 'src/app/models/friendinfo'; import { DatasharingService } from '../datasharing.service'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root' @@ -22,7 +23,7 @@ export class ChatService { public getAllChats(): Array { console.log("Getting all chats ..") - let url = 'https://greenvironment.net/graphql' + let url = environment.graphQLUrl let headers = new Headers() headers.set('Content-Type', 'application/json') diff --git a/src/app/services/feed/feed.service.ts b/src/app/services/feed/feed.service.ts index 7031e0f..bbd4230 100644 --- a/src/app/services/feed/feed.service.ts +++ b/src/app/services/feed/feed.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Post } from 'src/app/models/post'; import { Author } from 'src/app/models/author'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root' @@ -13,8 +14,7 @@ export class FeedService { constructor(private http: Http) { } public createPost(pContent: String){ - let url = 'https://greenvironment.net/graphql' - + let url = environment.graphQLUrl let headers = new Headers() headers.set('Content-Type', 'application/json') diff --git a/src/app/services/login/login.service.ts b/src/app/services/login/login.service.ts index ab2c5db..a18d0f4 100644 --- a/src/app/services/login/login.service.ts +++ b/src/app/services/login/login.service.ts @@ -5,6 +5,7 @@ import { User } from 'src/app/models/user'; import { DatasharingService } from '../datasharing.service'; import { userInfo } from 'os'; import {Router} from '@angular/router'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root' @@ -16,7 +17,7 @@ export class LoginService { public login(login : Login, errorCb: any) { //let url = './graphql' - let url = 'https://greenvironment.net/graphql' + let url = environment.graphQLUrl let headers = new Headers(); headers.set('Content-Type', 'application/json'); diff --git a/src/app/services/register/register.service.ts b/src/app/services/register/register.service.ts index dc8c2bd..b05a5aa 100644 --- a/src/app/services/register/register.service.ts +++ b/src/app/services/register/register.service.ts @@ -4,6 +4,7 @@ import { Registration } from '../../models/registration'; import {Router} from '@angular/router'; import { DatasharingService } from '../datasharing.service'; import { User } from 'src/app/models/user'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root' @@ -15,7 +16,7 @@ export class RegisterService { public register(registration: Registration, errorCb: any) { //let url = './graphql' - let url = 'https://greenvironment.net/graphql' + let url = environment.graphQLUrl let headers = new Headers(); headers.set('Content-Type', 'application/json'); diff --git a/src/app/services/selfservice/self.service.ts b/src/app/services/selfservice/self.service.ts index 9eb582b..5e92abf 100644 --- a/src/app/services/selfservice/self.service.ts +++ b/src/app/services/selfservice/self.service.ts @@ -5,6 +5,7 @@ import { User } from 'src/app/models/user'; import { DatasharingService } from '../datasharing.service'; import { userInfo } from 'os'; import {Router} from '@angular/router'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root' @@ -15,8 +16,8 @@ export class SelfService { public checkIfLoggedIn() { console.log('check if logged in...'); - //let url = './graphql' - let url = 'https://greenvironment.net/graphql' + + let url = environment.graphQLUrl; let headers = new Headers(); headers.set('Content-Type', 'application/json'); @@ -38,8 +39,6 @@ export class SelfService { public notLoggedIn(){ console.log('user was not logged in'); - //do routing - //this.router.navigateByUrl('/login'); } public updateUserInfo(response : any){ diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3612073..1bcd4f6 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,4 @@ export const environment = { - production: true + production: true, + graphQLUrl: '/graphql' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 7b4f817..8ddcf48 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -3,7 +3,8 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, + graphQLUrl: 'https://greenvironment.net/graphql' }; /*