Comment cleanup & few TODO fixes

This commit is contained in:
Aarni Halinen
2021-01-15 21:00:21 +02:00
parent a887f8844c
commit b986c39059
5 changed files with 5 additions and 7 deletions
+4 -2
View File
@@ -37,9 +37,11 @@ export async function getFeed(options: Options = {}): Promise<Post[]> {
} }
} }
export async function getPost(id: number): Promise<Post> { export async function getPost(id: number, options: Options = {}): Promise<Post> {
const { auth } = options;
const headers = auth ? { "Authorization": getAuthHeader() } : null;
try { try {
const resp = await axios.get(`${URL}${id}/`); const resp = await axios.get(`${URL}${id}/`, { headers });
return resp.data; return resp.data;
} catch (err) { } catch (err) {
console.error(err); console.error(err);
+1 -2
View File
@@ -150,8 +150,7 @@ const FeedCreatePage: NextPage = () => {
const feedId = id && Number(id); const feedId = id && Number(id);
if (feedId !== undefined) { if (feedId !== undefined) {
getPost(feedId) getPost(feedId, { auth: true })
// getPost(feedId, true)
.then(res => setFormData({ .then(res => setFormData({
...res, ...res,
tags: (res.tags).map(inst => inst.id) as any, tags: (res.tags).map(inst => inst.id) as any,
-1
View File
@@ -1,7 +1,6 @@
import React from "react"; import React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { JobAd } from "@models/JobAd"; import { JobAd } from "@models/JobAd";
// import { Link } from "@components/index";
import { Accordion } from "@components/index"; import { Accordion } from "@components/index";
import ReactMarkdown from "react-markdown"; import ReactMarkdown from "react-markdown";
-1
View File
@@ -22,7 +22,6 @@ const NRCGroup = "/img/corporate_logos/nrcgroup.png";
const Okmetic = "/img/corporate_logos/okmetic.png"; const Okmetic = "/img/corporate_logos/okmetic.png";
const Sogeti = "/img/corporate_logos/sogeti.jpg"; const Sogeti = "/img/corporate_logos/sogeti.jpg";
interface FrontPageViewProps { interface FrontPageViewProps {
events: Event[]; events: Event[];
feed: Post[]; feed: Post[];
-1
View File
@@ -4,7 +4,6 @@ import axios from "axios";
const API_URL = "https://api.dev.sik.party/api" const API_URL = "https://api.dev.sik.party/api"
export const getSiteRoot = (): string => process.env.SITE_URL || "http://localhost:3000"; 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 getPageUrl = ClientFunction(() => window.location.pathname);
export const getPostRequestLogger = (url: string) => RequestLogger({ url: `${API_URL}/${url}`, method: "post" }, { export const getPostRequestLogger = (url: string) => RequestLogger({ url: `${API_URL}/${url}`, method: "post" }, {