From 94d2fe36b368642a22491457feaebf7d8a10d360 Mon Sep 17 00:00:00 2001
From: Erik Borgeteien Hansen <erik@erikbhan.no>
Date: Mon, 2 May 2022 20:04:57 +0200
Subject: [PATCH] linting

---
 src/components/BaseComponents/NavBar.vue      |  4 +-
 .../CommunityComponents/NewCommunityForm.vue  | 11 ++--
 .../CommunityComponents/NewItemForm.vue       | 10 +++-
 src/components/FormComponents/LoginForm.vue   |  4 +-
 .../FormComponents/NewPasswordForm.vue        | 26 +++++---
 .../FormComponents/ResetPasswordForm.vue      | 22 ++++---
 .../LargeProfileCard.vue                      |  5 +-
 src/utils/apiutil.js                          | 59 +++++++++----------
 src/views/CommunityViews/NewCommunityView.vue |  1 -
 src/views/CommunityViews/NewItemView.vue      |  3 +-
 10 files changed, 82 insertions(+), 63 deletions(-)

diff --git a/src/components/BaseComponents/NavBar.vue b/src/components/BaseComponents/NavBar.vue
index 80dc794..251c1fe 100644
--- a/src/components/BaseComponents/NavBar.vue
+++ b/src/components/BaseComponents/NavBar.vue
@@ -38,12 +38,12 @@
 
 <script>
 import { parseUserFromToken } from "@/utils/token-utils";
-import {PlusIcon, ChatAlt2Icon, UserCircleIcon} from "@heroicons/vue/outline";
+import { PlusIcon, ChatAlt2Icon, UserCircleIcon } from "@heroicons/vue/outline";
 
 export default {
   name: "NavBar.vue",
 
-  components:{
+  components: {
     PlusIcon,
     ChatAlt2Icon,
     UserCircleIcon,
diff --git a/src/components/CommunityComponents/NewCommunityForm.vue b/src/components/CommunityComponents/NewCommunityForm.vue
index d9bf923..8edbda1 100644
--- a/src/components/CommunityComponents/NewCommunityForm.vue
+++ b/src/components/CommunityComponents/NewCommunityForm.vue
@@ -1,5 +1,7 @@
 <template>
-  <div class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4">
+  <div
+    class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4"
+  >
     <!-- Component heading -->
     <h3
       class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8"
@@ -170,12 +172,7 @@
 
     <!-- Save item button -->
     <div class="flex justify-center mt-10 float-right">
-      <Button
-        @click="saveClicked"
-        id="saveButton"
-        :text="'Lagre'"
-      >
-      </Button>
+      <Button @click="saveClicked" id="saveButton" :text="'Lagre'"> </Button>
     </div>
   </div>
 </template>
diff --git a/src/components/CommunityComponents/NewItemForm.vue b/src/components/CommunityComponents/NewItemForm.vue
index ea6abb8..0d26eb6 100644
--- a/src/components/CommunityComponents/NewItemForm.vue
+++ b/src/components/CommunityComponents/NewItemForm.vue
@@ -1,7 +1,13 @@
 <template>
-  <div class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4">
+  <div
+    class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4"
+  >
     <!-- Component heading -->
-    <h3 class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8">Opprett ny utleie</h3>
+    <h3
+      class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8"
+    >
+      Opprett ny utleie
+    </h3>
 
     <!-- Title -->
     <div class="mb-6" :class="{ error: v$.item.title.$errors.length }">
diff --git a/src/components/FormComponents/LoginForm.vue b/src/components/FormComponents/LoginForm.vue
index a3c4dd2..58f1d67 100644
--- a/src/components/FormComponents/LoginForm.vue
+++ b/src/components/FormComponents/LoginForm.vue
@@ -1,5 +1,7 @@
 <template>
-  <div class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full">
+  <div
+    class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full"
+  >
     <div class="px-6 py-4 mt-4">
       <h3
         class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8"
diff --git a/src/components/FormComponents/NewPasswordForm.vue b/src/components/FormComponents/NewPasswordForm.vue
index 667da92..d13c083 100644
--- a/src/components/FormComponents/NewPasswordForm.vue
+++ b/src/components/FormComponents/NewPasswordForm.vue
@@ -1,9 +1,12 @@
 <template>
   <div
-      class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4"
+    class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4"
   >
-
-    <h3 class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8">Endre passord</h3>
+    <h3
+      class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8"
+    >
+      Endre passord
+    </h3>
 
     <div
       id="firstPasswordField"
@@ -63,7 +66,7 @@
 
     <div id="buttonsField" class="mt-6">
       <Button
-          class="float-right"
+        class="float-right"
         @click="setNewPassword"
         :text="'Sett ny passord'"
       />
@@ -81,8 +84,9 @@ import Button from "@/components/BaseComponents/ColoredButton";
 export default {
   name: "NewPasswordForm.vue",
 
-  components:{
-    Button,},
+  components: {
+    Button,
+  },
   setup() {
     return { v$: useVuelidate() };
   },
@@ -91,10 +95,16 @@ export default {
       user: {
         password: {
           required: helpers.withMessage(`Feltet må være utfylt`, required),
-          minLength: helpers.withMessage('Passordet må være minst 8 karakterer lang', minLength(8)),
+          minLength: helpers.withMessage(
+            "Passordet må være minst 8 karakterer lang",
+            minLength(8)
+          ),
         },
         rePassword: {
-          sameAs: helpers.withMessage('Passordene må være like', sameAs(this.user.password)),
+          sameAs: helpers.withMessage(
+            "Passordene må være like",
+            sameAs(this.user.password)
+          ),
           required: helpers.withMessage(`Feltet må være utfylt`, required),
         },
       },
diff --git a/src/components/FormComponents/ResetPasswordForm.vue b/src/components/FormComponents/ResetPasswordForm.vue
index a3232e3..a4c2d80 100644
--- a/src/components/FormComponents/ResetPasswordForm.vue
+++ b/src/components/FormComponents/ResetPasswordForm.vue
@@ -1,7 +1,12 @@
 <template>
-  <div class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4">
-
-    <h3 class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8">Glemt passordet ditt?</h3>
+  <div
+    class="md:ring-1 ring-gray-300 rounded-xl overflow-hidden mx-auto mb-auto max-w-md w-full p-4"
+  >
+    <h3
+      class="text-xl font-medium text-center text-gray-600 dark:text-gray-200 mt-4 mb-8"
+    >
+      Glemt passordet ditt?
+    </h3>
 
     <div
       id="emailField"
@@ -35,12 +40,11 @@
         </div>
       </div>
       <Button
-          class="float-right"
-          @click="sendHome"
-          :text="'Tilbakestill passord'"
+        class="float-right"
+        @click="sendHome"
+        :text="'Tilbakestill passord'"
       />
     </div>
-
   </div>
 </template>
 
@@ -52,7 +56,7 @@ import Button from "@/components/BaseComponents/ColoredButton";
 export default {
   name: "ResetPassword.vue",
 
-  components:{
+  components: {
     Button,
   },
   data() {
@@ -67,7 +71,7 @@ export default {
   validations() {
     return {
       email: {
-        required: helpers.withMessage('Feltet må være utfylt', required),
+        required: helpers.withMessage("Feltet må være utfylt", required),
         email: helpers.withMessage(`E-posten er ugyldig`, email),
       },
     };
diff --git a/src/components/UserProfileComponents/LargeProfileCard.vue b/src/components/UserProfileComponents/LargeProfileCard.vue
index 4b88012..10eeba7 100644
--- a/src/components/UserProfileComponents/LargeProfileCard.vue
+++ b/src/components/UserProfileComponents/LargeProfileCard.vue
@@ -27,7 +27,10 @@
         v-show="dropdown"
         class="z-10 w-44 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700"
       >
-        <ul class="py-1 absolute bg-white ring-1 ring-gray-300 rounded-xl" aria-labelledby="dropdownDefault">
+        <ul
+          class="py-1 absolute bg-white ring-1 ring-gray-300 rounded-xl"
+          aria-labelledby="dropdownDefault"
+        >
           <li>
             <router-link
               to=""
diff --git a/src/utils/apiutil.js b/src/utils/apiutil.js
index 07fb78b..cb8d309 100644
--- a/src/utils/apiutil.js
+++ b/src/utils/apiutil.js
@@ -188,38 +188,37 @@ export async function GetMembersOfCommunity(communityID) {
 }
 
 export function JoinOpenCommunity(communityId) {
+  if (tokenHeader().Authorization == "Bearer " + null) {
+    console.log("ikke logget på!");
+    return "Login to join any community";
+  }
 
-    if(tokenHeader().Authorization == "Bearer " + null){
-        console.log("ikke logget på!");
-        return "Login to join any community";
-    }
-
-    return axios
-        .post(API_URL + "communities/" + communityId + "/join", communityId, {
-            headers: tokenHeader(),
-        })
-        .then((response) => {
-            return response;
-        })
-        .catch((error) => {
-            console.log(error.response);
-            return error;
-        });
+  return axios
+    .post(API_URL + "communities/" + communityId + "/join", communityId, {
+      headers: tokenHeader(),
+    })
+    .then((response) => {
+      return response;
+    })
+    .catch((error) => {
+      console.log(error.response);
+      return error;
+    });
 }
 
 export async function GetIfUserAlreadyInCommunity(communityID) {
-    if(tokenHeader().Authorization == "Bearer " + null){
-        return false;
-    }
-
-    return axios
-        .get(API_URL + "communities/" + communityID + "/user/status", {
-            headers: tokenHeader(),
-        })
-        .then((response) => {
-            return response.data;
-        })
-        .catch((error) => {
-            return error;
-        });
+  if (tokenHeader().Authorization == "Bearer " + null) {
+    return false;
+  }
+
+  return axios
+    .get(API_URL + "communities/" + communityID + "/user/status", {
+      headers: tokenHeader(),
+    })
+    .then((response) => {
+      return response.data;
+    })
+    .catch((error) => {
+      return error;
+    });
 }
diff --git a/src/views/CommunityViews/NewCommunityView.vue b/src/views/CommunityViews/NewCommunityView.vue
index f78ccde..e8274f2 100644
--- a/src/views/CommunityViews/NewCommunityView.vue
+++ b/src/views/CommunityViews/NewCommunityView.vue
@@ -2,7 +2,6 @@
   <div class="h-screen grid md:mt-8">
     <NewCommunity />
   </div>
-
 </template>
 
 <script>
diff --git a/src/views/CommunityViews/NewItemView.vue b/src/views/CommunityViews/NewItemView.vue
index 172ba80..5497873 100644
--- a/src/views/CommunityViews/NewItemView.vue
+++ b/src/views/CommunityViews/NewItemView.vue
@@ -1,8 +1,7 @@
 <template>
   <div class="h-screen grid md:mt-8">
-    <AddNewItem/>
+    <AddNewItem />
   </div>
-
 </template>
 
 <script>
-- 
GitLab