From 9f21ffe5f0d7333a44fb6fbf6749f8f2574b557a Mon Sep 17 00:00:00 2001 From: David Ralph Date: Sun, 20 Oct 2019 21:27:18 +0100 Subject: [PATCH] Remove no longer needed cookie code --- src/components/Background.jsx | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/components/Background.jsx b/src/components/Background.jsx index 69425261..1380d077 100644 --- a/src/components/Background.jsx +++ b/src/components/Background.jsx @@ -1,11 +1,6 @@ import React from 'react'; import Fetch from 'unfetch'; -const getCookie = (cookiename) => { - const cookiestring = RegExp('' + cookiename + '[^;]+').exec(document.cookie); - return unescape(!!cookiestring ? cookiestring.toString().replace(/^[^=]+./,'') : ''); -}; - const randomInt = (min, max) => { return Math.floor(Math.random() * (max - min + 1)) + min; }; export default class Background extends React.Component { @@ -17,18 +12,9 @@ export default class Background extends React.Component { let data = await Fetch('https://api.muetab.xyz/getImage?category=Outdoors'); data = await data.json(); - const checkRepeat = getCookie('backgroundimageurl'); + root.style.backgroundImage = `url(${data.file})`; document.getElementById('photographer').innerText = `Photo by ${data.photographer}`; - document.getElementById('location').innerText = `${data.location}`; - - if (checkRepeat !== root.style.backgroundImage) root.style.backgroundImage = `url(${data.file})`; - else { - /*let data = await Fetch('https://api.muetab.xyz/getImage?category=Outdoors'); - data = await data.json();*/ - document.cookie = 'backgroundimageurl; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; - root.style.backgroundImage = `url(${data.file})`; - document.cookie = `backgroundimageurl=${data.file}`; - } + document.getElementById('location').innerText = `${data.location}`; } catch (e) { document.getElementById('backgroundCredits').style.display = 'none'; document.getElementById('photographer').innerText = 'Photo from Pexels';