diff --git a/Front/kantor-angular/src/app/contents/contents.component.ts b/Front/kantor-angular/src/app/contents/contents.component.ts index c36ff590..bf0a186d 100644 --- a/Front/kantor-angular/src/app/contents/contents.component.ts +++ b/Front/kantor-angular/src/app/contents/contents.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {AxiosService} from "../axios.service"; @Component({ @@ -6,27 +6,55 @@ import {AxiosService} from "../axios.service"; templateUrl: './contents.component.html', styleUrl: './contents.component.scss' }) +// implements OnInit export class ContentsComponent { componentToShow: string = "welcome"; constructor(private axiosService: AxiosService) { } - onLogin(input: any) { - this.axiosService.request( - "POST", - "/login", - { - username: input.login, - password: input.password - } - ).then((response) => { - this.axiosService.setAuthTocken(response.data.token); - this.componentToShow = "messages"; - }); - - } + // Nie wiem co to robi ale buja + // ngOnInit() { + // if (!this.getCookie('firstVisit')) { + // this.clearAllCookies(); + // this.setCookie('firstVisit', 'true', 7); // Ustawia ciasteczko na 7 dni + // } + // } + // + // clearAllCookies() { + // const cookies = document.cookie.split(";"); + // + // for (let i = 0; i < cookies.length; i++) { + // const cookie = cookies[i]; + // const eqPos = cookie.indexOf("="); + // const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; + // document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; + // } + // } + // + // getCookie(cname: string) { + // let name = cname + "="; + // let decodedCookie = decodeURIComponent(document.cookie); + // let ca = decodedCookie.split(';'); + // for(let i = 0; i