| @@ -45,10 +45,6 @@ | |||
| "extractLicenses": false, | |||
| "vendorChunk": false, | |||
| "buildOptimizer": true, | |||
| "fileReplacements": [{ | |||
| "replace": "src/environments/environment.ts", | |||
| "with": "src/environments/environment.prod.ts" | |||
| }], | |||
| "serviceWorker": true, | |||
| "ngswConfigPath": "ngsw-config.json" | |||
| } | |||
| @@ -21,7 +21,7 @@ | |||
| "resources": { | |||
| "files": [ | |||
| "/assets/**", | |||
| "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)", | |||
| "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)" | |||
| ] | |||
| } | |||
| } | |||
| @@ -1,6 +1,5 @@ | |||
| import { NgModule } from '@angular/core'; | |||
| import { RouterModule, Routes } from '@angular/router'; | |||
| import { environment } from 'environments/environment'; | |||
| import { NotFoundComponent } from 'app/pages/not-found/not-found.component'; | |||
| import { ResumeComponent } from './pages/resume/resume.component'; | |||
| import { GamesDashboardComponent } from './pages/games-dashboard/games-dashboard.component'; | |||
| @@ -76,7 +75,7 @@ const routes: Routes = [ | |||
| @NgModule({ | |||
| imports: [ | |||
| RouterModule.forRoot(routes, { | |||
| enableTracing: !environment.production | |||
| enableTracing: false | |||
| }), | |||
| ], | |||
| exports: [RouterModule] | |||
| @@ -26,7 +26,6 @@ import { ResumePdfComponent } from './pages/resume-pdf/resume-pdf.component'; | |||
| import { PdfHeaderComponent } from './page-header/pdf-header/pdf-header.component'; | |||
| import { MusicHeaderComponent } from './page-header/music-header/music-header.component'; | |||
| import { ServiceWorkerModule } from '@angular/service-worker'; | |||
| import { environment } from '../environments/environment'; | |||
| @NgModule({ | |||
| @@ -57,7 +56,7 @@ import { environment } from '../environments/environment'; | |||
| AppRoutingModule, | |||
| ComponentsModule, | |||
| PageHeaderModule, | |||
| ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), | |||
| ServiceWorkerModule.register('ngsw-worker.js', { enabled: true }), | |||
| ], | |||
| providers: [], | |||
| bootstrap: [AppComponent] | |||
| @@ -1,61 +0,0 @@ | |||
| export namespace ServiceHelper { | |||
| export class GenericHelper { | |||
| public static deepClone(obj: Object) { | |||
| return JSON.parse(JSON.stringify(obj)); | |||
| } | |||
| } | |||
| export const SPOTIFY_STAUS_CODES = { | |||
| OK: 200, | |||
| CREATED: 201, | |||
| ACCEPTED: 202, | |||
| NO_CONTENT: 204, | |||
| NOT_MODIFIED: 304, | |||
| BAD_REQUEST: 400, | |||
| UNAUTHORIZED: 401, | |||
| FORBIDDEN: 403, | |||
| NOT_FOUND: 404, | |||
| TOO_MANY: 429, | |||
| INTERNAL: 500, | |||
| BAD_GATEWAY: 502, | |||
| SERVICE_UNAVAILABLE: 503, | |||
| } | |||
| export class PaginationOptions { limit: number; offset: number; total: number; current: number; }; | |||
| export class OfssetHelper { | |||
| /** | |||
| * Exptract Offset from URL. | |||
| * | |||
| * @param url url with offset GET Param | |||
| * @returns offset if found if not -1 | |||
| */ | |||
| public getNextOffsetFromUrl(url: string): number { | |||
| const extractOffsetRegex = /(?:offset=)(\d+)/; | |||
| const offset = extractOffsetRegex.exec(url); | |||
| if (offset[1]) { | |||
| return parseInt(offset[1]); | |||
| } | |||
| return -1 | |||
| } | |||
| public getNextOffset(responseBody: PaginationOptions) { | |||
| const maxOffset = responseBody.total - responseBody.limit; | |||
| if ( | |||
| responseBody.total <= responseBody.limit || | |||
| responseBody.offset >= responseBody.limit || | |||
| responseBody.offset >= maxOffset | |||
| ) { | |||
| return -1; | |||
| } | |||
| if (responseBody.offset < 0) { | |||
| throw new Error("offset can't be smaller than 0!"); | |||
| } | |||
| // if limit + current offset not overflows maxOffset return | |||
| if ((responseBody.limit + responseBody.offset) <= maxOffset) { | |||
| return responseBody.limit + responseBody.offset; | |||
| } | |||
| // return the rest | |||
| return responseBody.limit % responseBody.total; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,3 +0,0 @@ | |||
| export const environment = { | |||
| production: true | |||
| }; | |||
| @@ -1,8 +0,0 @@ | |||
| // The file contents for the current environment will overwrite these during build. | |||
| // The build system defaults to the dev environment which uses `environment.ts`, but if you do | |||
| // `ng build --env=prod` then `environment.prod.ts` will be used instead. | |||
| // The list of which env maps to which file can be found in `.angular-cli.json`. | |||
| export const environment = { | |||
| production: false | |||
| }; | |||
| @@ -16,10 +16,7 @@ import { enableProdMode } from '@angular/core'; | |||
| import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | |||
| import { AppModule } from './app/app.module'; | |||
| import { environment } from './environments/environment'; | |||
| if (environment.production) { | |||
| enableProdMode(); | |||
| } | |||
| enableProdMode(); | |||
| platformBrowserDynamic().bootstrapModule(AppModule); | |||