-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.astro
More file actions
51 lines (46 loc) · 1.62 KB
/
Copy pathindex.astro
File metadata and controls
51 lines (46 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
import BaseLayout from "../layouts/BaseLayout.astro";
if (Astro.request.method === "POST") {
try {
const slackUrl = `https://hooks.slack.com/services/${import.meta.env.VITE_SLACK}`
const data = await Astro.request.json();
const text = data.message;
fetch(slackUrl, {
method: 'POST',
body: JSON.stringify({text: text}),
headers: {
'Content-Type': 'application/json'
}
}).then(response => {
if (response.ok) {
console.log('Email sent successfully!');
} else {
console.error('Failed to send email!');
}
}).catch(error => {
console.error('Error:', error);
});
} catch (error) {
if (error instanceof Error) {
console.error(error.message);
}
}
}
---
<BaseLayout>
<script>
import {Engineer} from "../models/Engineer";
import {getCollection} from "astro:content";
const allGigs = await getCollection('gig');
const e = new Engineer("thomas", allGigs) //engineer comes setup with some commands
const terminal = document.querySelector('iterm-command-line');
terminal.commands = e.commands //stick the commands into the webcomponent
</script>
<iterm-command-line id="terminal"
greeting="Welcome to the DYOR website of a very lazy person!\nHey, my name is Thomas and I'm a Software / Cloud Engineer for hire"></iterm-command-line>
<style>
iterm-command-line {
height: 100vh;
}
</style>
</BaseLayout>