Skip to content

Commit

Permalink
Merge branch 'devs'
Browse files Browse the repository at this point in the history
  • Loading branch information
arrahmna-dev committed Nov 3, 2023
2 parents fe7aa0d + 5880a49 commit 7d87ebd
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 47 deletions.
9 changes: 4 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link id="stylesheet1" type="text/stylesheet" rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />
<link id="stylesheet2" type="text/stylesheet" rel="stylesheet" href="src/assets/css/bootstrap-extensions.css" />
<link id="stylesheet3" type="text/stylesheet" rel="stylesheet" href="src/assets/css/global.css" />
<link id="stylesheet4" type="text/stylesheet" rel="stylesheet" href="src/assets/css/style.css" />
<link id="stylesheet1" rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css" />
<link id="stylesheet2" rel="stylesheet" href="./src/assets/css/bootstrap-extensions.css" />
<link id="stylesheet3" rel="stylesheet" href="./src/assets/css/global.css" />
<link id="stylesheet4" rel="stylesheet" href="./src/assets/css/style.css" />
<title>Elecctronic bs | vue3</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

8 changes: 4 additions & 4 deletions src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ router.beforeEach((to, from, next) => {
const auth = authStore
if (to.meta.stylesheet !== from.meta.stylesheet) {
if (to.meta.stylesheet == 'public') {
cssElement1.href = stylesheets[to.meta.stylesheet][0];
cssElement2.href = stylesheets[to.meta.stylesheet][1];
cssElement3.href = stylesheets[to.meta.stylesheet][2];
cssElement4.href = stylesheets[to.meta.stylesheet][3];
cssElement1.href = baseURL + stylesheets[to.meta.stylesheet][0];
cssElement2.href = baseURL + stylesheets[to.meta.stylesheet][1];
cssElement3.href = baseURL + stylesheets[to.meta.stylesheet][2];
cssElement4.href = baseURL + stylesheets[to.meta.stylesheet][3];
} else {
cssElement1.href = stylesheets[to.meta.stylesheet];
cssElement2.href = '';
Expand Down
90 changes: 63 additions & 27 deletions src/store/authStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,71 @@ const authStore = reactive({
message: null,
status: null,

authenticate(name, password) {
fetch('http://127.0.0.1:8000/api/login', {
// fetch('https://dummyjson.com/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
// username: name,
// password: password,
email: name, password
// expiresInMins: 60, // optional // user : kminchelle, pas: 0lelplR
})
}).then(res => res.json())
.then((res) => {
console.log(res);
if (!res.error) {
//Object.assign(res, { role: ['user', 'admin', 'editor'] }) // push static role
async authenticate(name, password) {
try {
// const apiUrl = 'http://127.0.0.1:8000/api/login';
const apiUrl = 'https://dummyjson.com/auth/login';
const userConfig = {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username: name,
password: password,
//email: name, password
// expiresInMins: 60, // optional // user : kminchelle, pas: 0lelplR
})
}
const response = await axios.post(apiUrl, userConfig).then((res) => {

localStorage.setItem('user', JSON.stringify(res))
authStore.isAuthenticated = true
localStorage.setItem('auth', 1)
authStore.user = res
// dialog.closeModal()
toast.success(`Log in SUccessfull`)
router.push('/')
} else {
toast.error(`${res.message}`)
authStore.status = res.error
}
console.log(res.json());
})
// if (200 == response.status) {
// //Object.assign(res, { role: ['user', 'admin', 'editor'] }) // push static role
// localStorage.setItem('user', JSON.stringify(response))
// authStore.isAuthenticated = true
// localStorage.setItem('auth', 1)
// authStore.user = response
// // dialog.closeModal()
// toast.success(`Log in SUccessfull`)
// router.push('/')
// } else {
// toast.error(`${response.message}`)
// authStore.status = response.error
// }
} catch (error) {
toast.error(`Bad network connection`)
}
// fetch('http://127.0.0.1:8000/api/login', {
// // fetch('https://dummyjson.com/auth/login', {
// method: 'POST',
// headers: { 'Content-Type': 'application/json' },
// body: JSON.stringify({
// // username: name,
// // password: password,
// email: name, password
// // expiresInMins: 60, // optional // user : kminchelle, pas: 0lelplR
// })
// }).then(res => res.json())
// .then((res) => {
// console.log(res);
// if (!res.error) {
// //Object.assign(res, { role: ['user', 'admin', 'editor'] }) // push static role

// localStorage.setItem('user', JSON.stringify(res))
// authStore.isAuthenticated = true
// localStorage.setItem('auth', 1)
// authStore.user = res
// // dialog.closeModal()
// toast.success(`Log in SUccessfull`)
// router.push('/')
// } else {
// toast.error(`${res.message}`)
// authStore.status = res.error
// }
// console.log(res);
// })
// // .error(error){
// // toast.error(`Something want wrong`)
// // }
},
userRegister(Name, Email, Password) {
fetch('http://127.0.0.1:8000/api/users', {
Expand Down
4 changes: 2 additions & 2 deletions src/views/auth/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import { authStore } from "../../store/authStore"
const auth = authStore
const userEmail = ref("john@doe.com")
const userPassword = ref("12345")
const userEmail = ref("kminchelle") //kminchelle , john@doe.com
const userPassword = ref("0lelplR") //0lelplR, 12345
</script>

<template>
Expand Down
3 changes: 1 addition & 2 deletions src/views/public/header/TopHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
const userEmail = ref("john@doe.com")
const userPassword = ref("12345")
import "bootstrap/dist/css/bootstrap.min.css"
import "bootstrap"
</script>
<template>
<!--header-section-->
Expand Down
4 changes: 3 additions & 1 deletion src/views/public/home/BigBaner.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup></script>
<script setup>
const baseUrl = window.location.origin
</script>

<template>
<!--first-banner -section-->
Expand Down
12 changes: 6 additions & 6 deletions src/views/public/shop/Shop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
onBeforeMount(() => {
axios
// .get("https://dummyjson.com/products?limit=30")
.get("http://127.0.0.1:8000/api/products")
.get("https://dummyjson.com/products?limit=30")
// .get("http://127.0.0.1:8000/api/products")
.then((res) => {
products.value = res.data
// products.value = res.data.products
// products.value = res.data
products.value = res.data.products
})
.catch((error) => console.log(error))
})
Expand Down Expand Up @@ -414,8 +414,8 @@
<div class="card rounded-0 group-hover p-2 h-100">
<div class="overflow-hidden position-relative">
<div class="overflow-hidden text-center w-100" style="height: 100px">
<img class="h-100 w-100 object-fit-contain" :src="product['image']" />
<!-- <img class="h-100 w-100 object-fit-contain" :src="product['thumbnail']" /> -->
<!-- <img class="h-100 w-100 object-fit-contain" :src="product['image']" /> -->
<img class="h-100 w-100 object-fit-contain" :src="product['thumbnail']" />
</div>
<div class="hidden card-img-overlay rounded-0 d-flex p-0 bg-opacity-0 justify-content-end align-items-end bg-dark hover-bg-opacity-10 transition-1000">
<div class="position-absolute top- bottom-0 end-0 btn-group-vertical transform-rotateY-90 hover-transform-rotateY-0 transition-500" style="z-index: 100">
Expand Down

0 comments on commit 7d87ebd

Please sign in to comment.