Фронтовый микродвиж

This commit is contained in:
Dhaverd 2024-10-27 16:17:33 +08:00
parent 0266c0c07b
commit 77ca442f2e
3 changed files with 42 additions and 14 deletions

26
public/images/favicon.svg Normal file
View File

@ -0,0 +1,26 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1080" height="1080" viewBox="0 0 1080 1080" xml:space="preserve">
<desc>Created with Fabric.js 5.2.4</desc>
<defs>
</defs>
<rect x="0" y="0" width="100%" height="100%" fill="transparent"></rect>
<g transform="matrix(1 0 0 1 540 540)" id="4b5d70d4-b143-424b-9d1c-4bdec1268162" >
</g>
<g transform="matrix(1 0 0 1 540 540)" id="cf1001ba-a8d6-4521-ba5a-62a5bca7d9fd" >
<rect style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(255,255,255); fill-rule: nonzero; opacity: 1; visibility: hidden;" vector-effect="non-scaling-stroke" x="-540" y="-540" rx="0" ry="0" width="1080" height="1080" />
</g>
<g transform="matrix(45 0 0 45 540 540)" >
<path style="stroke: rgb(255,255,255); stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(255,255,255); fill-rule: nonzero; opacity: 1;" transform=" translate(-12, -12)" d="M 9 17 L 15 17 C 16.104569499661586 17 17 16.104569499661586 17 15 L 17 7 L 15 7 L 15 15 L 13 15 L 13 8 L 11 8 L 11 15 L 9 15 L 9 7 L 7 7 L 7 15 C 7 16.104569499661586 7.8954305003384135 17 9 17 M 5 3 L 19 3 C 20.104569499661586 3 21 3.8954305003384126 21 5 L 21 19 C 21 20.104569499661586 20.104569499661586 21 19 21 L 5 21 C 3.895430500338413 21 3 20.104569499661586 3 19 L 3 5 C 3 3.895430500338413 3.895430500338413 3 5 3 Z" stroke-linecap="round" />
</g>
<g transform="matrix(NaN NaN NaN NaN 0 0)" >
<g style="" >
</g>
</g>
<g transform="matrix(NaN NaN NaN NaN 0 0)" >
<g style="" >
</g>
</g>
<g transform="matrix(NaN NaN NaN NaN 0 0)" >
<g style="" >
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,4 +1,4 @@
import { defineStore } from 'pinia'
import {defineStore} from 'pinia'
import axios from "axios";
export const useUserStore = defineStore('user', {
@ -16,7 +16,7 @@ export const useUserStore = defineStore('user', {
this.token = token;
localStorage.setItem('auth_token', token);
},
checkUser(){
checkUser() {
axios.get(
'/api/auth/user',
{
@ -28,32 +28,33 @@ export const useUserStore = defineStore('user', {
}
).then((res) => {
this.setUser(res.data);
}).catch((error)=>{
}).catch((error) => {
this.nullifyUser();
})
},
async login(email, password, rememberMe){
async login(email, password, rememberMe) {
await axios.post(
'/api/auth/login',
{
'email': email,
'password': password,
'remember_me': rememberMe
}).then((res) => {
}).then((res) => {
this.setUser(res.data.user);
this.setToken(res.data.accessToken);
return true;
}).catch((error)=>{
if (!error.response){
}).catch((error) => {
if (!error.response) {
return false;
}
return error.response.data.message;
})
},
async registration(login, email, password, repeatPassword){
async registration(login, email, password, repeatPassword) {
await axios.post(
'/api/auth/register',
{'name': login,
{
'name': login,
'email': email,
'password': password,
'c_password': repeatPassword
@ -61,14 +62,14 @@ export const useUserStore = defineStore('user', {
this.setUser(res.data.user);
this.setToken(res.data.accessToken);
return true;
}).catch((error)=>{
if (!error.response){
}).catch((error) => {
if (!error.response) {
return false;
}
return error.response.data.message;
})
},
logout(){
logout() {
axios.get('/api/auth/logout',
{
headers:
@ -80,7 +81,7 @@ export const useUserStore = defineStore('user', {
);
this.nullifyUser();
},
nullifyUser(){
nullifyUser() {
this.setUser(null);
this.setToken(null);
}

View File

@ -3,7 +3,8 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Boilerplate</title>
<title>Wishlist</title>
<link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml">
@vite('resources/app.js')
@vite('resources/css/app.css')
</head>