diff --git a/src/models/Feed.ts b/src/models/Feed.ts index 3910380..3b3299c 100644 --- a/src/models/Feed.ts +++ b/src/models/Feed.ts @@ -37,9 +37,11 @@ export async function getFeed(options: Options = {}): Promise { } } -export async function getPost(id: number): Promise { +export async function getPost(id: number, options: Options = {}): Promise { + const { auth } = options; + const headers = auth ? { "Authorization": getAuthHeader() } : null; try { - const resp = await axios.get(`${URL}${id}/`); + const resp = await axios.get(`${URL}${id}/`, { headers }); return resp.data; } catch (err) { console.error(err); diff --git a/src/pages/admin/feed/[id].tsx b/src/pages/admin/feed/[id].tsx index f18ab24..4f6d24c 100644 --- a/src/pages/admin/feed/[id].tsx +++ b/src/pages/admin/feed/[id].tsx @@ -150,8 +150,7 @@ const FeedCreatePage: NextPage = () => { const feedId = id && Number(id); if (feedId !== undefined) { - getPost(feedId) - // getPost(feedId, true) + getPost(feedId, { auth: true }) .then(res => setFormData({ ...res, tags: (res.tags).map(inst => inst.id) as any, diff --git a/src/views/CorporatePage/JobAdList.tsx b/src/views/CorporatePage/JobAdList.tsx index c6627e4..833da33 100644 --- a/src/views/CorporatePage/JobAdList.tsx +++ b/src/views/CorporatePage/JobAdList.tsx @@ -1,7 +1,6 @@ import React from "react"; import styled from "styled-components"; import { JobAd } from "@models/JobAd"; -// import { Link } from "@components/index"; import { Accordion } from "@components/index"; import ReactMarkdown from "react-markdown"; diff --git a/src/views/FrontPage/FrontPageView.tsx b/src/views/FrontPage/FrontPageView.tsx index a5c1dc4..5ef05ab 100644 --- a/src/views/FrontPage/FrontPageView.tsx +++ b/src/views/FrontPage/FrontPageView.tsx @@ -22,7 +22,6 @@ const NRCGroup = "/img/corporate_logos/nrcgroup.png"; const Okmetic = "/img/corporate_logos/okmetic.png"; const Sogeti = "/img/corporate_logos/sogeti.jpg"; - interface FrontPageViewProps { events: Event[]; feed: Post[]; diff --git a/tests/testcafe/utils.ts b/tests/testcafe/utils.ts index c4258e0..d6a54fa 100644 --- a/tests/testcafe/utils.ts +++ b/tests/testcafe/utils.ts @@ -4,7 +4,6 @@ import axios from "axios"; const API_URL = "https://api.dev.sik.party/api" export const getSiteRoot = (): string => process.env.SITE_URL || "http://localhost:3000"; -// export const getPageUrl = ClientFunction(() => window.location.href.toString()); export const getPageUrl = ClientFunction(() => window.location.pathname); export const getPostRequestLogger = (url: string) => RequestLogger({ url: `${API_URL}/${url}`, method: "post" }, {