diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88a855777e8255f1a9d7856cb8170940992932d8..52b5c89fb7194811439d1e748ef88f946429e405 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ deploy-to-staging: stage: deploy-to-staging environment: name: staging - url: https://memepro-diskuy-frontend.netlify.app + url: https://faas-kezia.netlify.app only: - staging script: diff --git a/src/components/thread/CreateThread.jsx b/src/components/thread/CreateThread.jsx index 11870d537a3fbc3446acef80772f7d9a36ff028c..dc4399b42cdad98fbeffe482d71294b4e26fcb65 100644 --- a/src/components/thread/CreateThread.jsx +++ b/src/components/thread/CreateThread.jsx @@ -1,8 +1,8 @@ import axios from 'axios'; import React, { useState, useEffect } from 'react'; import { useInput } from '../../helpers/hooks/input-hook'; -import { authHeader } from '../../helpers/services/auth.service'; -import { API_URL } from '../../config/keys'; +import { authHeader, userData } from '../../helpers/services/auth.service'; +import { API_URL, FAAS_URL } from '../../config/keys'; import '../../styles/thread/Form.css'; export default function ListThreads(props) { @@ -51,6 +51,12 @@ export default function ListThreads(props) { headers: authHeader(), } ); + + const discordMessage = userData(); + discordMessage.title = title; + axios + .post(`${FAAS_URL}/notifyDiscord`, discordMessage); + const { data } = thisThread?.data; redirect(`/topic/${data?.topic_name}/${data?.id}/page/1`); } catch (error) { diff --git a/src/config/keys.js b/src/config/keys.js index 4bb616fe12f7c69817bcfaf31fc2966a8889fe2c..7e774041770732316970573195f42ab10e84e63f 100644 --- a/src/config/keys.js +++ b/src/config/keys.js @@ -1,3 +1,4 @@ export const API_URL = process.env.REACT_APP_API_URL || 'https://diskuyapi-google.herokuapp.com/api'; +export const FAAS_URL = 'https://faas-kezia-be.netlify.app/.netlify/functions'; export const CLIENT_ID = - process.env.REACT_APP_CLIENT_ID || '501878885013-126phco7bblqngas8kd1ubfa3r0hciq3.apps.googleusercontent.com'; + process.env.REACT_APP_CLIENT_ID || '272732138595-ep2nguvntea9lp8jvjok97a235efos69.apps.googleusercontent.com'; diff --git a/src/helpers/services/auth.service.js b/src/helpers/services/auth.service.js index 246d02586958837d860cde963cef8166713e0a6e..5390766e04ce1db1cae19f1f05a3feb10fd07e42 100644 --- a/src/helpers/services/auth.service.js +++ b/src/helpers/services/auth.service.js @@ -28,6 +28,11 @@ export const authHeader = () => { } }; +export const userData = () => { + const user = JSON.parse(localStorage.getItem('user')); + return user.data; +} + export const loggedIn = JSON.parse(localStorage.getItem('user')) && 1; export const isAdmin =