Browse Source

chore(project): Here we go

jackyalcine 11 months ago
parent
commit
aac521fae5
Signed by: Jacky Alciné <yo@jacky.wtf> GPG Key ID: 537A4F904B15268D

+ 2
- 0
.dockerignore View File

@@ -0,0 +1,2 @@
1
+web/node_modules
2
+web/dist

+ 1
- 0
.gitignore View File

@@ -23,3 +23,4 @@ erl_crash.dump
23 23
 indiemarkscanner-*.tar
24 24
 
25 25
 .elixir_ls
26
+web/.stylelintrc.js

+ 35
- 0
Dockerfile View File

@@ -0,0 +1,35 @@
1
+FROM node:8.11.3 as client
2
+ENV APP_DIR=${APP_DIR:-/opt/indiemarkscanner/} \
3
+    NODE_ENV=${NODE_ENV:-production}
4
+WORKDIR $APP_DIR/
5
+COPY web ./
6
+RUN NODE_ENV=development npm install --verbose
7
+RUN npm run build --verbose
8
+RUN apt update
9
+RUN apt install tree
10
+RUN rm node_modules -rf
11
+RUN tree
12
+
13
+FROM elixir:1.6.4-alpine as api
14
+RUN apk add -U bash git build-base
15
+ARG MIX_ENV=prod
16
+ENV PORT=${PORT:-5000} \
17
+    APP_DIR=${APP_DIR:-/opt/indiemarkscanner/} \
18
+    MIX_ENV=${MIX_ENV:-prod} \
19
+    TZ=Etc/UTC
20
+SHELL ["/bin/bash", "-c"]
21
+WORKDIR $APP_DIR/
22
+RUN mix do local.hex --force, \
23
+    local.rebar --force, \
24
+    hex.info
25
+COPY mix.exs mix.lock ./
26
+EXPOSE ${PORT}
27
+RUN mix deps.get
28
+RUN mix deps.compile
29
+RUN apk add -u tree
30
+COPY . .
31
+RUN tree ${APP_DIR}/web
32
+RUN tree ${APP_DIR}/dist
33
+COPY --from=client ${APP_DIR}/dist ${APP_DIR}/dist
34
+RUN mix compile
35
+CMD mix run --no-halt

+ 1
- 5
config/config.exs View File

@@ -1,8 +1,4 @@
1 1
 use Mix.Config
2 2
 
3
-config :maru, IndieMark.Scanner.Api, http: [
4
-  port: 5000,
5
-  bind_addr: "0.0.0.0"
6
-]
7 3
 
8
-# import_config "#{Mix.env}.exs"
4
+import_config "#{Mix.env}.exs"

+ 6
- 0
config/dev.exs View File

@@ -0,0 +1,6 @@
1
+use Mix.Config
2
+
3
+config :maru, IndieMark.Scanner.Api, http: [
4
+  port: 5000,
5
+  bind_addr: "0.0.0.0"
6
+]

+ 6
- 0
config/prod.exs View File

@@ -0,0 +1,6 @@
1
+use Mix.Config
2
+
3
+config :maru, IndieMark.Scanner.Api, http: [
4
+  port: 5000,
5
+  bind_addr: "0.0.0.0"
6
+]

+ 4
- 0
config/test.exs View File

@@ -0,0 +1,4 @@
1
+use Mix.Config
2
+
3
+config :maru, IndieMark.Scanner.Api,
4
+  test: true

+ 0
- 16
lib/indiemark/scanner.ex View File

@@ -1,18 +1,2 @@
1 1
 defmodule IndieMark.Scanner do
2
-  @moduledoc """
3
-  Documentation for IndieMark.Scanner.
4
-  """
5
-
6
-  @doc """
7
-  Hello world.
8
-
9
-  ## Examples
10
-
11
-      iex> IndieMark.Scanner.hello
12
-      :world
13
-
14
-  """
15
-  def hello do
16
-    :world
17
-  end
18 2
 end

+ 10
- 4
lib/indiemark/scanner/api.ex View File

@@ -1,17 +1,18 @@
1 1
 defmodule IndieMark.Scanner.Api do
2 2
   use Maru.Router
3 3
 
4
-  plug(Plug.Logger)
5
-  plug(Plug.RequestId)
6
-  plug(Plug.Head)
7
-
8 4
   before do
5
+    plug(Plug.Logger)
6
+    plug(Plug.RequestId)
7
+    plug(Plug.Head)
9 8
     plug(
10 9
       Plug.Parsers,
11 10
       pass: ["text/*", "application/json"],
12 11
       json_decoder: Poison,
13 12
       parsers: [:urlencoded, :json, :multipart]
14 13
     )
14
+    static_path = Path.join(File.cwd!(), "web/dist")
15
+    plug(Plug.Static, at: "/", from: static_path, gzip: false)
15 16
   end
16 17
 
17 18
   resource :scans do
@@ -20,4 +21,9 @@ defmodule IndieMark.Scanner.Api do
20 21
       |> json(%{foo: :bar})
21 22
     end
22 23
   end
24
+
25
+  get "/" do
26
+    conn
27
+    |> redirect("/index.html", permanent: true)
28
+  end
23 29
 end

+ 1
- 5
lib/indiemark/scanner/application.ex View File

@@ -5,14 +5,10 @@ defmodule IndieMark.Scanner.Application do
5 5
   use Application
6 6
 
7 7
   def start(_type, _args) do
8
-    import Supervisor.Spec, warn: true
9
-
10
-    children = [
11
-    ]
8
+    children = []
12 9
     opts = [strategy: :one_for_one]
13 10
 
14 11
     load_code_reloading()
15
-
16 12
     Supervisor.start_link(children, opts)
17 13
   end
18 14
 

+ 63
- 0
lib/indiemark/scanner/level1.ex View File

@@ -0,0 +1,63 @@
1
+defmodule IndieMark.Scanner.Level1 do
2
+  @base_headers %{
3
+    "User-Agent" => "IndieMark Scanner"
4
+  }
5
+
6
+  @base_req_options [
7
+    follow_redirect: true,
8
+    max_redirect: 5
9
+  ]
10
+
11
+  def map_to_point(requirements) when is_list(requirements) do
12
+    Enum.sum(Enum.map(requirements, fn req -> map_to_point(req) end))
13
+  end
14
+
15
+  def map_to_point(requirement) when is_atom(requirement) do
16
+    case requirement do
17
+      :domain -> 0.2
18
+      :authentication -> 0.2
19
+      _ -> 0.0
20
+    end
21
+  end
22
+
23
+  def resolve_domain(domain) do
24
+    result = DNS.resolve(domain)
25
+
26
+    case result do
27
+      {:ok, _ip} ->
28
+        :ok
29
+
30
+      {:error, error} ->
31
+        {:error, "DNS resolution error: #{error}"}
32
+    end
33
+  end
34
+
35
+  def resolve_authentication(domain) do
36
+    body = HTTPoison.get!(domain, @base_headers, @base_req_options).body
37
+
38
+    relme = extract_relme(body)
39
+    indieauth = extract_indieauth(body)
40
+
41
+    {:ok, relme ++ indieauth }
42
+  end
43
+
44
+  defp extract_relme(body) do
45
+    body
46
+    |> Floki.find("link[rel=me]")
47
+    |> Enum.map(fn tag -> extract_href_for(tag, :relme) end)
48
+  end
49
+
50
+  defp extract_href_for(tag, type) do
51
+    %{href: Floki.attribute(tag, "href") |> List.first(), type: type}
52
+  end
53
+
54
+  defp extract_indieauth(body) do
55
+    authn = Floki.find(body, "link[rel=authorization_endpoint]")
56
+    token = Floki.find(body, "link[rel=token_endpoint]")
57
+
58
+    [
59
+      extract_href_for(authn, :authorization),
60
+      extract_href_for(token, :token)
61
+    ]
62
+  end
63
+end

+ 17
- 3
mix.exs View File

@@ -4,11 +4,15 @@ defmodule IndieMark.Scanner.MixProject do
4 4
   def project do
5 5
     [
6 6
       app: :indiemarkscanner,
7
+      aliases: aliases(),
7 8
       version: "0.0.1",
8 9
       elixir: "~> 1.6",
9 10
       start_permanent: Mix.env() == :prod,
10 11
       deps: deps(Mix.env()),
11 12
       elixirc_paths: elixirc_paths(Mix.env()),
13
+      preferred_cli_env: [
14
+        test: :test
15
+      ]
12 16
     ]
13 17
   end
14 18
 
@@ -16,7 +20,8 @@ defmodule IndieMark.Scanner.MixProject do
16 20
     [
17 21
       mod: {IndieMark.Scanner.Application, []},
18 22
       extra_applications: [
19
-        :logger
23
+        :logger,
24
+        :dns
20 25
       ]
21 26
     ]
22 27
   end
@@ -26,10 +31,19 @@ defmodule IndieMark.Scanner.MixProject do
26 31
 
27 32
   defp deps(_env) do
28 33
     [
34
+      {:apex, "~> 1.2.0", only: [:dev]},
35
+      {:exsync, "~> 0.2", only: [:dev]},
36
+      {:httpoison, "~> 1.2.0"},
29 37
       {:maru, "~> 0.12.0"},
30 38
       {:poison, "~> 3.0.0"},
31
-      {:httpoison, "~> 1.2.0"},
32
-      {:exsync, "~> 0.2", only: [:dev]},
39
+      {:dns, "~> 2.1.0"},
40
+      {:floki, "~> 0.20.3"},
41
+    ]
42
+  end
43
+
44
+  defp aliases() do
45
+    [
46
+      start: ["run --no-halt"]
33 47
     ]
34 48
   end
35 49
 end

+ 6
- 0
mix.lock View File

@@ -1,20 +1,26 @@
1 1
 %{
2
+  "apex": {:hex, :apex, "1.2.1", "297f5dac23fa2a32648b890a0838fce2772114010e0b9ec975cae6021cc5a092", [:mix], [], "hexpm"},
2 3
   "certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
3 4
   "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
4 5
   "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm"},
6
+  "dns": {:hex, :dns, "2.1.0", "4777fe07ae3060c1d5d75024f05c26d7e11fa701d48a6edb9fc305d24cd12c8c", [:mix], [{:socket, "~> 0.3.13", [hex: :socket, repo: "hexpm", optional: false]}], "hexpm"},
5 7
   "exsync": {:hex, :exsync, "0.2.3", "a1ac11b4bd3808706003dbe587902101fcc1387d9fc55e8b10972f13a563dd15", [:mix], [{:file_system, "~> 0.2", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm"},
6 8
   "file_system": {:hex, :file_system, "0.2.6", "fd4dc3af89b9ab1dc8ccbcc214a0e60c41f34be251d9307920748a14bf41f1d3", [:mix], [], "hexpm"},
9
+  "floki": {:hex, :floki, "0.20.3", "dfb3a71eb99938e330b4156433d55c6d0b188d936c9683d115a8540bac56e019", [:mix], [{:html_entities, "~> 0.4.0", [hex: :html_entities, repo: "hexpm", optional: false]}, {:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"},
7 10
   "hackney": {:hex, :hackney, "1.13.0", "24edc8cd2b28e1c652593833862435c80661834f6c9344e84b6a2255e7aeef03", [:rebar3], [{:certifi, "2.3.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.2", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
11
+  "html_entities": {:hex, :html_entities, "0.4.0", "f2fee876858cf6aaa9db608820a3209e45a087c5177332799592142b50e89a6b", [:mix], [], "hexpm"},
8 12
   "httpoison": {:hex, :httpoison, "1.2.0", "2702ed3da5fd7a8130fc34b11965c8cfa21ade2f232c00b42d96d4967c39a3a3", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
9 13
   "idna": {:hex, :idna, "5.1.2", "e21cb58a09f0228a9e0b95eaa1217f1bcfc31a1aaa6e1fdf2f53a33f7dbd9494", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
10 14
   "maru": {:hex, :maru, "0.12.5", "86c7a74b405fc08f71c386206b26969152d999e9c2589391850bb3b633d2c0ca", [:mix], [{:cowboy, "~> 1.1", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
11 15
   "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"},
12 16
   "mime": {:hex, :mime, "1.3.0", "5e8d45a39e95c650900d03f897fbf99ae04f60ab1daa4a34c7a20a5151b7a5fe", [:mix], [], "hexpm"},
13 17
   "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"},
18
+  "mochiweb": {:hex, :mochiweb, "2.18.0", "eb55f1db3e6e960fac4e6db4e2db9ec3602cc9f30b86cd1481d56545c3145d2e", [:rebar3], [], "hexpm"},
14 19
   "parse_trans": {:hex, :parse_trans, "3.2.0", "2adfa4daf80c14dc36f522cf190eb5c4ee3e28008fc6394397c16f62a26258c2", [:rebar3], [], "hexpm"},
15 20
   "plug": {:hex, :plug, "1.6.2", "e06a7bd2bb6de5145da0dd950070110dce88045351224bd98e84edfdaaf5ffee", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"},
16 21
   "poison": {:hex, :poison, "3.0.0", "625ebd64d33ae2e65201c2c14d6c85c27cc8b68f2d0dd37828fde9c6920dd131", [:mix], [], "hexpm"},
17 22
   "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], [], "hexpm"},
23
+  "socket": {:hex, :socket, "0.3.13", "98a2ab20ce17f95fb512c5cadddba32b57273e0d2dba2d2e5f976c5969d0c632", [:mix], [], "hexpm"},
18 24
   "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"},
19 25
   "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm"},
20 26
 }

+ 43
- 0
test/indiemark/scanner/level1_test.exs View File

@@ -0,0 +1,43 @@
1
+defmodule IndieMark.Scanner.Level1Test do
2
+  use ExUnit.Case
3
+  doctest IndieMark.Scanner.Level1
4
+  alias IndieMark.Scanner.Level1, as: Level
5
+
6
+  test "returns the proper points for single key" do
7
+    assert Level.map_to_point(:domain) == 0.2
8
+  end
9
+
10
+  test "returns the proper points for list" do
11
+    assert Level.map_to_point([:domain, :authentication, :foo]) == 0.4
12
+  end
13
+
14
+  test "returns status of successful TLD resolving" do
15
+    assert Level.resolve_domain("jacky.wtf") == :ok
16
+  end
17
+
18
+  test "returns status of failure to resolve TLD" do
19
+    subject = Level.resolve_domain("fake.domainzlzozl")
20
+    assert subject == {:error, "DNS resolution error: not_found"}
21
+  end
22
+
23
+  test "returns status of successful subdomain resolving" do
24
+    assert Level.resolve_domain("indiemark.jacky.wtf") == :ok
25
+  end
26
+
27
+  test "returns status of failure to resolve subdomain"
28
+
29
+  test "returns list of rel-me on page" do
30
+    assert {:ok, results} = Level.resolve_authentication("jacky.wtf")
31
+    assert %{href: "https://github.com/jalcine", type: :relme} in results
32
+  end
33
+
34
+  test "returns list of authn endpoint on page" do
35
+    assert {:ok, results} = Level.resolve_authentication("jacky.wtf")
36
+    assert %{href: "https://indieauth.com/auth", type: :authorization} in results
37
+  end
38
+
39
+  test "returns list of token endpoint on page" do
40
+    assert {:ok, results} = Level.resolve_authentication("jacky.wtf")
41
+    assert %{href: "https://tokens.indieauth.com/token", type: :token} in results
42
+  end
43
+end

+ 0
- 4
test/indiemark/scanner_test.exs View File

@@ -1,8 +1,4 @@
1 1
 defmodule IndieMark.ScannerTest do
2 2
   use ExUnit.Case
3 3
   doctest IndieMark.Scanner
4
-
5
-  test "greets the world" do
6
-    assert IndieMark.Scanner.hello() == :world
7
-  end
8 4
 end

+ 5
- 0
web/package-lock.json View File

@@ -9333,6 +9333,11 @@
9333 9333
       "integrity": "sha512-WvF3Myk0NhXkG8S9bygFM4IC1KOvnVJGq0QoGeoqOYOBeinBZp5ybW3QuYbTc89lkWBMM9ZBO4QGRoc0353kKA==",
9334 9334
       "dev": true
9335 9335
     },
9336
+    "normalize.css": {
9337
+      "version": "8.0.0",
9338
+      "resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.0.tgz",
9339
+      "integrity": "sha512-iXcbM3NWr0XkNyfiSBsoPezi+0V92P9nj84yVV1/UZxRUrGczgX/X91KMAGM0omWLY2+2Q1gKD/XRn4gQRDB2A=="
9340
+    },
9336 9341
     "npm-path": {
9337 9342
       "version": "2.0.4",
9338 9343
       "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.4.tgz",

+ 1
- 0
web/package.json View File

@@ -8,6 +8,7 @@
8 8
     "lint": "vue-cli-service lint"
9 9
   },
10 10
   "dependencies": {
11
+    "normalize.css": "8.0.0",
11 12
     "typeface-alegreya": "0.0.54",
12 13
     "typeface-alegreya-sans": "0.0.54",
13 14
     "vue": "^2.5.17",

+ 1
- 1
web/src/App.vue View File

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <main>
2
+  <main role="document">
3 3
     <Header />
4 4
     <router-view />
5 5
     <Footer />

+ 62
- 4
web/src/assets/css/main.scss View File

@@ -1,7 +1,65 @@
1
-body, p, div, blockquote, input, button, main, header, footer {
2
-  font-family: "Alegreya Sans", sans-serif;
1
+:root {
2
+  --font-family-sans: "Alegreya Sans", sans-serif;
3
+  --font-family-serif: "Alegreya", serif;
4
+  --background: var(--white);
5
+  --foreground: var(--black);
6
+  --black: #121212;
7
+  --white: #efefef;
8
+  --gray:  #AAAAAA;
9
+  --blue:  #0074D9;
10
+  --red:   #FF4136;
11
+  --yellow: #FFDC00;
12
+  --link: var(--blue);
3 13
 }
4 14
 
5
-h1, h2, h3, h4, h5, h6 {
6
-  font-family: "Alegreya", serif;
15
+body {
16
+  background-color: var(--background);
17
+  color: var(--foreground);
18
+}
19
+
20
+a {
21
+  color: var(--link);
22
+
23
+  &:visited {
24
+    color: var(--link);
25
+  }
26
+}
27
+
28
+p, div, blockquote, input, button, main, header, footer, section {
29
+  font-family: var(--font-family-sans);
30
+}
31
+
32
+h1, h2, h3, h4, h5, h6, blockquote {
33
+  font-family: var(--font-family-serif);
34
+}
35
+
36
+h1.headline {
37
+  font-size: 3rem;
38
+}
39
+
40
+main[role=document] {
41
+  max-width: 60rem;
42
+  width: 100%;
43
+  margin: 0rem auto;
44
+}
45
+
46
+header[role=document] {
47
+  padding: 0.5rem 1rem;
48
+  text-align: center;
49
+
50
+  img {
51
+    vertical-align: middle;
52
+    display: inline-block;
53
+  }
54
+}
55
+
56
+input {
57
+  border: 1px solid var(--gray);
58
+  padding: 0.375rem 0.5rem;
59
+}
60
+
61
+button {
62
+  border: 1px solid var(--gray);
63
+  padding: 0.375rem 0.5rem;
64
+  text-transform: uppercase;
7 65
 }

BIN
web/src/assets/img/logo.png View File


BIN
web/src/assets/logo.png View File


+ 14
- 1
web/src/components/Header.vue View File

@@ -1,5 +1,18 @@
1 1
 <template>
2
-  <header />
2
+  <header role="document">
3
+    <h1 class="headline">
4
+      <img src="../assets/img/logo.png" height="64" />
5
+      IndieMark Scanner
6
+    </h1>
7
+    <h3>
8
+      Determine the
9
+      <a target="_blank" href="https://indieweb.org/IndieMark">
10
+        IndieMark
11
+      </a>
12
+      of your
13
+      <a target="_blank" href="http://indieweb.org/">IndieWeb site</a>.
14
+    </h3>
15
+  </header>
3 16
 </template>
4 17
 
5 18
 <script lang="ts">

+ 1
- 0
web/src/main.js View File

@@ -5,6 +5,7 @@ import router from "./router";
5 5
 
6 6
 import "typeface-alegreya";
7 7
 import "typeface-alegreya-sans";
8
+import "normalize.css";
8 9
 
9 10
 Vue.config.productionTip = false;
10 11
 

+ 1
- 1
web/src/router.js View File

@@ -5,7 +5,7 @@ import Home from "./views/Home.vue";
5 5
 Vue.use(Router);
6 6
 
7 7
 export default new Router({
8
-  mode: "history",
8
+  mode: "hash",
9 9
   base: process.env.BASE_URL,
10 10
   routes: [
11 11
     {

+ 13
- 7
web/src/views/Home.vue View File

@@ -1,15 +1,14 @@
1 1
 <template>
2 2
   <section>
3
-    <h1>IndieMark Scanner Thing</h1>
4
-    <p>Enter a domain and do some dumb shit with it.</p>
3
+    <p>
4
+      Enter a valid URI that you'd like to scan.
5
+    </p>
5 6
     <input type="text" v-model="domain" />
6 7
     <button v-on:click="testDomain">Scan</button>
7 8
   </section>
8 9
 </template>
9 10
 
10 11
 <script>
11
-import axios from "axios";
12
-
13 12
 export default {
14 13
   data: function() {
15 14
     return {
@@ -18,11 +17,18 @@ export default {
18 17
   },
19 18
   methods: {
20 19
     testDomain: function() {
21
-      console.log("foo");
22 20
       return this.$axios
23 21
         .put("http://localhost:5000/scans/new")
24
-        .then(console.log)
25
-        .catch(console.log);
22
+        .then(this.parseResults)
23
+        .catch(this.handleIssues);
24
+    },
25
+
26
+    parseResults: function(results) {
27
+      console.log(results);
28
+    },
29
+
30
+    handleIssues: function(err) {
31
+      console.error(err);
26 32
     }
27 33
   },
28 34
   name: "landing"

Loading…
Cancel
Save