Add eslint-plugin-vue

This commit is contained in:
KevinNThomas
2021-07-17 15:57:05 -07:00
parent 1871ea9eb7
commit 6479b32063
11 changed files with 4908 additions and 3394 deletions

View File

@@ -7,12 +7,12 @@
<script>
export default {
data() {
data () {
return {
msg: "The superheros",
};
},
};
msg: 'The superheros'
}
}
}
</script>
<style scoped>
h1,
@@ -30,4 +30,4 @@ li {
a {
color: #42b983;
}
</style>
</style>

View File

@@ -7,12 +7,12 @@
<script>
export default {
data() {
data () {
return {
msg: "Hello World!",
};
},
};
msg: 'Hello World!'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

View File

@@ -21,44 +21,44 @@
<script>
export default {
data() {
data () {
return {
email: "",
password: "",
};
email: '',
password: ''
}
},
methods: {
handleSubmit(e) {
e.preventDefault();
handleSubmit (e) {
e.preventDefault()
if (this.password.length > 0) {
this.$http
.post("http://localhost:3000/login", {
.post('http://localhost:3000/login', {
email: this.email,
password: this.password,
password: this.password
})
.then((response) => {
let is_admin = response.data.user.is_admin;
localStorage.setItem("user", JSON.stringify(response.data.user));
localStorage.setItem("jwt", response.data.token);
const isAdmin = response.data.user.isAdmin
localStorage.setItem('user', JSON.stringify(response.data.user))
localStorage.setItem('jwt', response.data.token)
if (localStorage.getItem("jwt") != null) {
this.$emit("loggedIn");
if (localStorage.getItem('jwt') != null) {
this.$emit('loggedIn')
if (this.$route.params.nextUrl != null) {
this.$router.push(this.$route.params.nextUrl);
this.$router.push(this.$route.params.nextUrl)
} else {
if (is_admin == 1) {
this.$router.push("admin");
if (isAdmin === 1) {
this.$router.push('admin')
} else {
this.$router.push("dashboard");
this.$router.push('dashboard')
}
}
}
})
.catch(function (error) {
console.error(error.response);
});
console.error(error.response)
})
}
},
},
};
}
}
}
</script>

View File

@@ -29,7 +29,7 @@
<label for="password-confirm">Is this an administrator account?</label>
<div>
<select v-model="is_admin">
<select v-model="isAdmin">
<option value="1">Yes</option>
<option value="0">No</option>
</select>
@@ -44,57 +44,58 @@
<script>
export default {
props: ["nextUrl"],
data() {
props: ['nextUrl'],
data () {
return {
name: "",
email: "",
password: "",
password_confirmation: "",
is_admin: null,
};
name: '',
email: '',
password: '',
password_confirmation: '',
isAdmin: null
}
},
methods: {
handleSubmit(e) {
e.preventDefault();
handleSubmit (e) {
e.preventDefault()
if (
this.password === this.password_confirmation &&
this.password.length > 0
) {
let url = "http://localhost:3000/register";
if (this.is_admin != null || this.is_admin == 1)
url = "http://localhost:3000/register-admin";
let url = 'http://localhost:3000/register'
if (this.isAdmin != null || this.isAdmin === 1) {
url = 'http://localhost:3000/register-admin'
}
this.$http
.post(url, {
name: this.name,
email: this.email,
password: this.password,
is_admin: this.is_admin,
isAdmin: this.isAdmin
})
.then((response) => {
localStorage.setItem("user", JSON.stringify(response.data.user));
localStorage.setItem("jwt", response.data.token);
localStorage.setItem('user', JSON.stringify(response.data.user))
localStorage.setItem('jwt', response.data.token)
if (localStorage.getItem("jwt") != null) {
this.$emit("loggedIn");
if (localStorage.getItem('jwt') != null) {
this.$emit('loggedIn')
if (this.$route.params.nextUrl != null) {
this.$router.push(this.$route.params.nextUrl);
this.$router.push(this.$route.params.nextUrl)
} else {
this.$router.push("/");
this.$router.push('/')
}
}
})
.catch((error) => {
console.error(error);
});
console.error(error)
})
} else {
this.password = "";
this.passwordConfirm = "";
this.password = ''
this.passwordConfirm = ''
return alert("Passwords do not match");
return alert('Passwords do not match')
}
},
},
};
}
}
}
</script>

View File

@@ -7,12 +7,12 @@
<script>
export default {
data() {
data () {
return {
msg: "The commoners",
};
},
};
msg: 'The commoners'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
@@ -32,4 +32,4 @@ li {
a {
color: #42b983;
}
</style>
</style>