From 828a53705406764b45c4965deb2dd8e31fcda508 Mon Sep 17 00:00:00 2001 From: Brandon Sarazin Date: Tue, 24 May 2022 19:32:24 -0400 Subject: [PATCH 1/3] lab07 --- code/Brandon/javascript/lab07/index.html | 24 ++++++++++++++ code/Brandon/javascript/lab07/script.js | 40 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 code/Brandon/javascript/lab07/index.html create mode 100644 code/Brandon/javascript/lab07/script.js diff --git a/code/Brandon/javascript/lab07/index.html b/code/Brandon/javascript/lab07/index.html new file mode 100644 index 00000000..ce57322a --- /dev/null +++ b/code/Brandon/javascript/lab07/index.html @@ -0,0 +1,24 @@ + + + + + + + + + + + Weather Alerts + + +
+

Weather Alerts

+ + + +
+ + \ No newline at end of file diff --git a/code/Brandon/javascript/lab07/script.js b/code/Brandon/javascript/lab07/script.js new file mode 100644 index 00000000..1a609f17 --- /dev/null +++ b/code/Brandon/javascript/lab07/script.js @@ -0,0 +1,40 @@ +axios({ + url: "https://api.weather.gov/", + method: "get", + header: { + Accept: "application/json", + }, +}).then((res) => console.log(res.data)); + +const App = { + data() { + return { + alerts: "", + baseUrl: "https://api.weather.gov/", + }; + }, + + created() { + this.getAlerts(); + }, + + methods: { + getAlerts() { + console.log({ "this in getAlerts": this }); + axios({ + url: this.baseUrl + "alerts", + headers: { + Accept: "application/json", + }, + method: "get", + }).then((res) => { + console.log({ "this in .then": this }); + this.alerts = res.data.features; + }); + }, + }, +}; + +const app = Vue.createApp(App); + +app.mount("#app"); From d3a8abe0957bfbc31e96ba70b3ebbf3f26eba9fa Mon Sep 17 00:00:00 2001 From: Brandon Sarazin Date: Wed, 25 May 2022 19:32:43 -0400 Subject: [PATCH 2/3] lab07 --- code/Brandon/javascript/lab07/index.html | 65 ++++++++++++++++++++++-- code/Brandon/javascript/lab07/script.js | 20 ++++++-- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/code/Brandon/javascript/lab07/index.html b/code/Brandon/javascript/lab07/index.html index ce57322a..665a2722 100644 --- a/code/Brandon/javascript/lab07/index.html +++ b/code/Brandon/javascript/lab07/index.html @@ -13,12 +13,71 @@

Weather Alerts

- + +
+
+ + -
    +

    10 latest weather alerts in {{ searchTerm }}

    +
    • ***{{ item.properties.areaDesc }}*** -
      {{ item.properties.description }}
    • +
      {{ item.properties.description }}
+
\ No newline at end of file diff --git a/code/Brandon/javascript/lab07/script.js b/code/Brandon/javascript/lab07/script.js index 1a609f17..ed698f7f 100644 --- a/code/Brandon/javascript/lab07/script.js +++ b/code/Brandon/javascript/lab07/script.js @@ -10,13 +10,13 @@ const App = { data() { return { alerts: "", + searchTerm: "", + state: "", baseUrl: "https://api.weather.gov/", }; }, - created() { - this.getAlerts(); - }, + created() {}, methods: { getAlerts() { @@ -32,6 +32,20 @@ const App = { this.alerts = res.data.features; }); }, + + getState() { + console.log({ "this in getAlerts": this }); + axios({ + url: this.baseUrl + "alerts/active", + headers: { + Accept: "application/json", + }, + params: { area: this.searchTerm }, + }).then((res) => { + console.log({ "this in .then": this }); + this.alerts = res.data.features; + }); + }, }, }; From 0058fdfa6b6ca1146bbd7374c24a1ef8bcd935b1 Mon Sep 17 00:00:00 2001 From: Brandon Sarazin Date: Thu, 26 May 2022 19:04:13 -0400 Subject: [PATCH 3/3] lab07 --- code/Brandon/javascript/lab07/index.html | 27 ++++++++++++++---------- code/Brandon/javascript/lab07/script.js | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/code/Brandon/javascript/lab07/index.html b/code/Brandon/javascript/lab07/index.html index 665a2722..54e89258 100644 --- a/code/Brandon/javascript/lab07/index.html +++ b/code/Brandon/javascript/lab07/index.html @@ -8,16 +8,17 @@ + Weather Alerts - -
-

Weather Alerts

- + +
+

Weather Alerts

+
+
-
- - @@ -71,13 +72,17 @@

Weather Alerts

+ +
+
-

10 latest weather alerts in {{ searchTerm }}

-
    -
  • ***{{ item.properties.areaDesc }}*** +

    10 latest weather alerts for {{ searchTerm }}

    +
      +
    • ***{{ item.properties.areaDesc }}***
      {{ item.properties.description }}
    • -
    +
+
\ No newline at end of file diff --git a/code/Brandon/javascript/lab07/script.js b/code/Brandon/javascript/lab07/script.js index ed698f7f..b3f9e674 100644 --- a/code/Brandon/javascript/lab07/script.js +++ b/code/Brandon/javascript/lab07/script.js @@ -30,6 +30,7 @@ const App = { }).then((res) => { console.log({ "this in .then": this }); this.alerts = res.data.features; + this.searchTerm = "the US"; }); },