Client - refactoring (rename auth user store)
This commit is contained in:
parent
3a1245a2e0
commit
f97c7ae4d0
2
fittrackee/dist/index.html
vendored
2
fittrackee/dist/index.html
vendored
@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.27bf6ef5.css" rel="prefetch"><link href="/static/css/main.18c88976.css" rel="prefetch"><link href="/static/css/main~workouts.dec22e70.css" rel="prefetch"><link href="/static/css/profile.8c004342.css" rel="prefetch"><link href="/static/css/reset.0a21856c.css" rel="prefetch"><link href="/static/css/workouts.45fb3086.css" rel="prefetch"><link href="/static/js/admin.ae6123c4.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.308f7e1a.js" rel="prefetch"><link href="/static/js/main~workouts.896585f2.js" rel="prefetch"><link href="/static/js/profile.998bc0bd.js" rel="prefetch"><link href="/static/js/reset.624f741d.js" rel="prefetch"><link href="/static/js/workouts.13789396.js" rel="prefetch"><link href="/static/css/app.4717d662.css" rel="preload" as="style"><link href="/static/js/app.fba56819.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.61765c73.js" rel="preload" as="script"><link href="/static/css/app.4717d662.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.61765c73.js"></script><script src="/static/js/app.fba56819.js"></script></body></html>
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"><link rel="stylesheet" href="/static/css/leaflet.css"><title>FitTrackee</title><link href="/static/css/admin.51f3889f.css" rel="prefetch"><link href="/static/css/main.3dbd1a70.css" rel="prefetch"><link href="/static/css/main~workouts.dec22e70.css" rel="prefetch"><link href="/static/css/profile.e4d63f07.css" rel="prefetch"><link href="/static/css/reset.23e340ac.css" rel="prefetch"><link href="/static/css/workouts.2c38ccab.css" rel="prefetch"><link href="/static/js/admin.4f80b9a8.js" rel="prefetch"><link href="/static/js/chunk-2d0c9189.c81458cc.js" rel="prefetch"><link href="/static/js/chunk-2d0cf391.020c75ea.js" rel="prefetch"><link href="/static/js/chunk-2d0da8f3.c8c3e7e8.js" rel="prefetch"><link href="/static/js/chunk-2d2248b6.d84473c1.js" rel="prefetch"><link href="/static/js/chunk-2d22523a.4b710d99.js" rel="prefetch"><link href="/static/js/main.76bd2954.js" rel="prefetch"><link href="/static/js/main~workouts.896585f2.js" rel="prefetch"><link href="/static/js/profile.459d43b2.js" rel="prefetch"><link href="/static/js/reset.ac1dbf71.js" rel="prefetch"><link href="/static/js/workouts.6316965e.js" rel="prefetch"><link href="/static/css/app.f74c42aa.css" rel="preload" as="style"><link href="/static/js/app.e8c58f6b.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.61765c73.js" rel="preload" as="script"><link href="/static/css/app.f74c42aa.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.61765c73.js"></script><script src="/static/js/app.e8c58f6b.js"></script></body></html>
|
@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/img/workouts/mountains.svg"
|
"url": "/img/workouts/mountains.svg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "f75f8df3621aa692bd0f287b779f98b7",
|
"revision": "d5f56a00602843295cbb57cc7f9edb11",
|
||||||
"url": "/index.html"
|
"url": "/index.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -76,12 +76,12 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/robots.txt"
|
"url": "/robots.txt"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "69e937fea34882d7ed93",
|
"revision": "3aafca1672085cfe7801",
|
||||||
"url": "/static/css/admin.27bf6ef5.css"
|
"url": "/static/css/admin.51f3889f.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "e370f660b4615a7b1407",
|
"revision": "e023ae1d78f5fdd9cb9b",
|
||||||
"url": "/static/css/app.4717d662.css"
|
"url": "/static/css/app.f74c42aa.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "82c1118c918377daaa71a320ab8eea42",
|
"revision": "82c1118c918377daaa71a320ab8eea42",
|
||||||
@ -92,24 +92,24 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/static/css/leaflet.css"
|
"url": "/static/css/leaflet.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "e3c1b38f9a3f799718d9",
|
"revision": "aefb8dff07fb12c92af9",
|
||||||
"url": "/static/css/main.18c88976.css"
|
"url": "/static/css/main.3dbd1a70.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "70f944368dc20379d927",
|
"revision": "70f944368dc20379d927",
|
||||||
"url": "/static/css/main~workouts.dec22e70.css"
|
"url": "/static/css/main~workouts.dec22e70.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "ef95ddeede4ae9177c5f",
|
"revision": "ba64d8c1e3160e666080",
|
||||||
"url": "/static/css/profile.8c004342.css"
|
"url": "/static/css/profile.e4d63f07.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "79922e937a9828c3da47",
|
"revision": "b9d96855f88c81057953",
|
||||||
"url": "/static/css/reset.0a21856c.css"
|
"url": "/static/css/reset.23e340ac.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "8673354a75e744432857",
|
"revision": "9d8048d00736d73f0f41",
|
||||||
"url": "/static/css/workouts.45fb3086.css"
|
"url": "/static/css/workouts.2c38ccab.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "e719f9244c69e28e7d00e725ca1e280e",
|
"revision": "e719f9244c69e28e7d00e725ca1e280e",
|
||||||
@ -192,12 +192,12 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/static/img/pt-sans-v9-latin-regular.f1f73e45.svg"
|
"url": "/static/img/pt-sans-v9-latin-regular.f1f73e45.svg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "69e937fea34882d7ed93",
|
"revision": "3aafca1672085cfe7801",
|
||||||
"url": "/static/js/admin.ae6123c4.js"
|
"url": "/static/js/admin.4f80b9a8.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "e370f660b4615a7b1407",
|
"revision": "e023ae1d78f5fdd9cb9b",
|
||||||
"url": "/static/js/app.fba56819.js"
|
"url": "/static/js/app.e8c58f6b.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "bd7d183c9f68e5f4027d",
|
"revision": "bd7d183c9f68e5f4027d",
|
||||||
@ -224,23 +224,23 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||||||
"url": "/static/js/chunk-vendors.61765c73.js"
|
"url": "/static/js/chunk-vendors.61765c73.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "e3c1b38f9a3f799718d9",
|
"revision": "aefb8dff07fb12c92af9",
|
||||||
"url": "/static/js/main.308f7e1a.js"
|
"url": "/static/js/main.76bd2954.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "70f944368dc20379d927",
|
"revision": "70f944368dc20379d927",
|
||||||
"url": "/static/js/main~workouts.896585f2.js"
|
"url": "/static/js/main~workouts.896585f2.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "ef95ddeede4ae9177c5f",
|
"revision": "ba64d8c1e3160e666080",
|
||||||
"url": "/static/js/profile.998bc0bd.js"
|
"url": "/static/js/profile.459d43b2.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "79922e937a9828c3da47",
|
"revision": "b9d96855f88c81057953",
|
||||||
"url": "/static/js/reset.624f741d.js"
|
"url": "/static/js/reset.ac1dbf71.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "8673354a75e744432857",
|
"revision": "9d8048d00736d73f0f41",
|
||||||
"url": "/static/js/workouts.13789396.js"
|
"url": "/static/js/workouts.6316965e.js"
|
||||||
}
|
}
|
||||||
]);
|
]);
|
2
fittrackee/dist/service-worker.js
vendored
2
fittrackee/dist/service-worker.js
vendored
@ -14,7 +14,7 @@
|
|||||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||||
|
|
||||||
importScripts(
|
importScripts(
|
||||||
"/precache-manifest.aab9327d959797e12b9f2af90df626c8.js"
|
"/precache-manifest.2949bbdde18bf700f94e62007d119e2f.js"
|
||||||
);
|
);
|
||||||
|
|
||||||
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});
|
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/admin.4f80b9a8.js
vendored
Normal file
2
fittrackee/dist/static/js/admin.4f80b9a8.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["admin"],{"726e":function(e,t,o){},8185:function(e,t,o){"use strict";o("a27b")},"89b3":function(e,t,o){"use strict";o.r(t);var n=o("7a23"),c=Object(n["withScopeId"])("data-v-2fbe41f1");Object(n["pushScopeId"])("data-v-2fbe41f1");var r={id:"admin",class:"view"},a={key:0,class:"container"},i=Object(n["createVNode"])("div",{id:"bottom"},null,-1);Object(n["popScopeId"])();var p=c((function(e,t,o,c,p,u){var s=Object(n["resolveComponent"])("router-view"),d=Object(n["resolveComponent"])("NotFound");return Object(n["openBlock"])(),Object(n["createBlock"])("div",r,[e.userLoading?Object(n["createCommentVNode"])("",!0):(Object(n["openBlock"])(),Object(n["createBlock"])("div",a,[e.isAuthUserAmin?(Object(n["openBlock"])(),Object(n["createBlock"])(s,{key:0,appConfig:e.appConfig,appStatistics:e.appStatistics},null,8,["appConfig","appStatistics"])):(Object(n["openBlock"])(),Object(n["createBlock"])(d,{key:1})),i]))])})),u=o("f7f9"),s=o("dad5"),d=o("2906"),b=Object(n["defineComponent"])({name:"Admin",components:{NotFound:u["a"]},setup:function(){var e=Object(d["a"])();Object(n["onBeforeMount"])((function(){return e.dispatch(s["b"].ACTIONS.GET_APPLICATION_STATS)}));var t=Object(n["computed"])((function(){return e.getters[s["b"].GETTERS.APP_LOADING]})),o=Object(n["computed"])((function(){return e.getters[s["b"].GETTERS.APP_CONFIG]})),c=Object(n["computed"])((function(){return e.getters[s["b"].GETTERS.APP_STATS]})),r=Object(n["computed"])((function(){return e.getters[s["a"].GETTERS.IS_ADMIN]})),a=Object(n["computed"])((function(){return e.getters[s["a"].GETTERS.USER_LOADING]}));return{appConfig:o,appLoading:t,appStatistics:c,isAuthUserAmin:r,userLoading:a}}});o("d14e");b.render=p,b.__scopeId="data-v-2fbe41f1";t["default"]=b},a27b:function(e,t,o){},d14e:function(e,t,o){"use strict";o("726e")},f7f9:function(e,t,o){"use strict";var n=o("7a23");function c(e,t,o,c,r,a){var i=Object(n["resolveComponent"])("Error");return Object(n["openBlock"])(),Object(n["createBlock"])(i,{title:"404",message:e.$t("error.NOT_FOUND.".concat(e.target)),"button-text":e.$t("common.HOME")},null,8,["message","button-text"])}var r=Object(n["withScopeId"])("data-v-58e20d75");Object(n["pushScopeId"])("data-v-58e20d75");var a={id:"error"},i={class:"error-content"};Object(n["popScopeId"])();var p=r((function(e,t,o,c,r,p){return Object(n["openBlock"])(),Object(n["createBlock"])("div",a,[Object(n["createVNode"])("div",i,[Object(n["createVNode"])("h1",null,Object(n["toDisplayString"])(e.title),1),Object(n["createVNode"])("p",null,Object(n["toDisplayString"])(e.message),1),e.buttonText?(Object(n["openBlock"])(),Object(n["createBlock"])("button",{key:0,onClick:t[1]||(t[1]=function(t){return e.$router.push(e.path)}),class:"upper"},Object(n["toDisplayString"])(e.buttonText),1)):Object(n["createCommentVNode"])("",!0)])])})),u=Object(n["defineComponent"])({name:"Error",props:{title:{type:String,required:!0},message:{type:String},buttonText:{type:String},path:{type:String,default:"/"}}});o("8185");u.render=p,u.__scopeId="data-v-58e20d75";var s=u,d=Object(n["defineComponent"])({name:"NotFound",components:{Error:s},props:{target:{type:String,default:"PAGE"}}});d.render=c;t["a"]=d}}]);
|
||||||
|
//# sourceMappingURL=admin.4f80b9a8.js.map
|
1
fittrackee/dist/static/js/admin.4f80b9a8.js.map
vendored
Normal file
1
fittrackee/dist/static/js/admin.4f80b9a8.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/admin.ae6123c4.js
vendored
2
fittrackee/dist/static/js/admin.ae6123c4.js
vendored
@ -1,2 +0,0 @@
|
|||||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["admin"],{8185:function(e,t,o){"use strict";o("a27b")},"89b3":function(e,t,o){"use strict";o.r(t);var n=o("7a23"),c=Object(n["withScopeId"])("data-v-008a67d8");Object(n["pushScopeId"])("data-v-008a67d8");var r={id:"admin",class:"view"},a={key:0,class:"container"},i=Object(n["createVNode"])("div",{id:"bottom"},null,-1);Object(n["popScopeId"])();var p=c((function(e,t,o,c,p,u){var d=Object(n["resolveComponent"])("router-view"),s=Object(n["resolveComponent"])("NotFound");return Object(n["openBlock"])(),Object(n["createBlock"])("div",r,[e.userLoading?Object(n["createCommentVNode"])("",!0):(Object(n["openBlock"])(),Object(n["createBlock"])("div",a,[e.isAuthUserAmin?(Object(n["openBlock"])(),Object(n["createBlock"])(d,{key:0,appConfig:e.appConfig,appStatistics:e.appStatistics},null,8,["appConfig","appStatistics"])):(Object(n["openBlock"])(),Object(n["createBlock"])(s,{key:1})),i]))])})),u=o("f7f9"),d=o("dad5"),s=o("2906"),b=Object(n["defineComponent"])({name:"Admin",components:{NotFound:u["a"]},setup:function(){var e=Object(s["a"])();Object(n["onBeforeMount"])((function(){return e.dispatch(d["a"].ACTIONS.GET_APPLICATION_STATS)}));var t=Object(n["computed"])((function(){return e.getters[d["a"].GETTERS.APP_LOADING]})),o=Object(n["computed"])((function(){return e.getters[d["a"].GETTERS.APP_CONFIG]})),c=Object(n["computed"])((function(){return e.getters[d["a"].GETTERS.APP_STATS]})),r=Object(n["computed"])((function(){return e.getters[d["e"].GETTERS.IS_ADMIN]})),a=Object(n["computed"])((function(){return e.getters[d["e"].GETTERS.USER_LOADING]}));return{appConfig:o,appLoading:t,appStatistics:c,isAuthUserAmin:r,userLoading:a}}});o("b3a7");b.render=p,b.__scopeId="data-v-008a67d8";t["default"]=b},"922f":function(e,t,o){},a27b:function(e,t,o){},b3a7:function(e,t,o){"use strict";o("922f")},f7f9:function(e,t,o){"use strict";var n=o("7a23");function c(e,t,o,c,r,a){var i=Object(n["resolveComponent"])("Error");return Object(n["openBlock"])(),Object(n["createBlock"])(i,{title:"404",message:e.$t("error.NOT_FOUND.".concat(e.target)),"button-text":e.$t("common.HOME")},null,8,["message","button-text"])}var r=Object(n["withScopeId"])("data-v-58e20d75");Object(n["pushScopeId"])("data-v-58e20d75");var a={id:"error"},i={class:"error-content"};Object(n["popScopeId"])();var p=r((function(e,t,o,c,r,p){return Object(n["openBlock"])(),Object(n["createBlock"])("div",a,[Object(n["createVNode"])("div",i,[Object(n["createVNode"])("h1",null,Object(n["toDisplayString"])(e.title),1),Object(n["createVNode"])("p",null,Object(n["toDisplayString"])(e.message),1),e.buttonText?(Object(n["openBlock"])(),Object(n["createBlock"])("button",{key:0,onClick:t[1]||(t[1]=function(t){return e.$router.push(e.path)}),class:"upper"},Object(n["toDisplayString"])(e.buttonText),1)):Object(n["createCommentVNode"])("",!0)])])})),u=Object(n["defineComponent"])({name:"Error",props:{title:{type:String,required:!0},message:{type:String},buttonText:{type:String},path:{type:String,default:"/"}}});o("8185");u.render=p,u.__scopeId="data-v-58e20d75";var d=u,s=Object(n["defineComponent"])({name:"NotFound",components:{Error:d},props:{target:{type:String,default:"PAGE"}}});s.render=c;t["a"]=s}}]);
|
|
||||||
//# sourceMappingURL=admin.ae6123c4.js.map
|
|
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/app.e8c58f6b.js
vendored
Normal file
2
fittrackee/dist/static/js/app.e8c58f6b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
fittrackee/dist/static/js/app.e8c58f6b.js.map
vendored
Normal file
1
fittrackee/dist/static/js/app.e8c58f6b.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/app.fba56819.js
vendored
2
fittrackee/dist/static/js/app.fba56819.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/main.308f7e1a.js
vendored
2
fittrackee/dist/static/js/main.308f7e1a.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/main.76bd2954.js
vendored
Normal file
2
fittrackee/dist/static/js/main.76bd2954.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
fittrackee/dist/static/js/main.76bd2954.js.map
vendored
Normal file
1
fittrackee/dist/static/js/main.76bd2954.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/profile.459d43b2.js
vendored
Normal file
2
fittrackee/dist/static/js/profile.459d43b2.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["profile"],{"0ab6":function(e,t,r){},"36e8":function(e,t,r){"use strict";r.r(t);var c=r("7a23"),n=Object(c["withScopeId"])("data-v-37d55f74");Object(c["pushScopeId"])("data-v-37d55f74");var o={key:0,id:"profile",class:"container view"};Object(c["popScopeId"])();var a=n((function(e,t,r,n,a,s){var u=Object(c["resolveComponent"])("router-view");return e.authUser.username?(Object(c["openBlock"])(),Object(c["createBlock"])("div",o,[Object(c["createVNode"])(u,{user:e.authUser},null,8,["user"])])):Object(c["createCommentVNode"])("",!0)})),s=r("dad5"),u=r("2906"),d=Object(c["defineComponent"])({name:"ProfileView",setup:function(){var e=Object(u["a"])(),t=Object(c["computed"])((function(){return e.getters[s["a"].GETTERS.AUTH_USER_PROFILE]}));return{authUser:t}}});r("a6f2");d.render=a,d.__scopeId="data-v-37d55f74";t["default"]=d},"7ffc":function(e,t,r){"use strict";r("b288")},a6f2:function(e,t,r){"use strict";r("0ab6")},ad3d:function(e,t,r){"use strict";r.r(t);var c=r("7a23"),n=Object(c["withScopeId"])("data-v-82f4bbf6");Object(c["pushScopeId"])("data-v-82f4bbf6");var o={key:0,id:"user",class:"view"},a={class:"box"};Object(c["popScopeId"])();var s=n((function(e,t,r,n,s,u){var d=Object(c["resolveComponent"])("UserHeader"),f=Object(c["resolveComponent"])("UserInfos");return e.user.username?(Object(c["openBlock"])(),Object(c["createBlock"])("div",o,[Object(c["createVNode"])(d,{user:e.user},null,8,["user"]),Object(c["createVNode"])("div",a,[Object(c["createVNode"])(f,{user:e.user,"from-admin":!0},null,8,["user"])])])):Object(c["createCommentVNode"])("",!0)})),u=r("6c02"),d=r("3c44"),f=r("71a7"),i=r("dad5"),b=r("2906"),p=Object(c["defineComponent"])({name:"UserView",components:{UserHeader:d["a"],UserInfos:f["a"]},setup:function(){var e=Object(u["c"])(),t=Object(b["a"])(),r=Object(c["computed"])((function(){return t.getters[i["e"].GETTERS.USER]}));return Object(c["onBeforeMount"])((function(){e.params.username&&"string"===typeof e.params.username&&t.dispatch(i["e"].ACTIONS.GET_USER,e.params.username)})),Object(c["onBeforeUnmount"])((function(){t.dispatch(i["e"].ACTIONS.EMPTY_USER)})),{user:r}}});r("7ffc");p.render=s,p.__scopeId="data-v-82f4bbf6";t["default"]=p},b288:function(e,t,r){}}]);
|
||||||
|
//# sourceMappingURL=profile.459d43b2.js.map
|
1
fittrackee/dist/static/js/profile.459d43b2.js.map
vendored
Normal file
1
fittrackee/dist/static/js/profile.459d43b2.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,2 +0,0 @@
|
|||||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["profile"],{"36e8":function(e,t,c){"use strict";c.r(t);var r=c("7a23"),n=Object(r["withScopeId"])("data-v-5dfc12f0");Object(r["pushScopeId"])("data-v-5dfc12f0");var o={key:0,id:"profile",class:"container view"};Object(r["popScopeId"])();var a=n((function(e,t,c,n,a,s){var u=Object(r["resolveComponent"])("router-view");return e.authUser.username?(Object(r["openBlock"])(),Object(r["createBlock"])("div",o,[Object(r["createVNode"])(u,{user:e.authUser},null,8,["user"])])):Object(r["createCommentVNode"])("",!0)})),s=c("dad5"),u=c("2906"),d=Object(r["defineComponent"])({name:"ProfileView",setup:function(){var e=Object(u["a"])(),t=Object(r["computed"])((function(){return e.getters[s["e"].GETTERS.AUTH_USER_PROFILE]}));return{authUser:t}}});c("f1f4");d.render=a,d.__scopeId="data-v-5dfc12f0";t["default"]=d},"7ffc":function(e,t,c){"use strict";c("b288")},"8f15":function(e,t,c){},ad3d:function(e,t,c){"use strict";c.r(t);var r=c("7a23"),n=Object(r["withScopeId"])("data-v-82f4bbf6");Object(r["pushScopeId"])("data-v-82f4bbf6");var o={key:0,id:"user",class:"view"},a={class:"box"};Object(r["popScopeId"])();var s=n((function(e,t,c,n,s,u){var d=Object(r["resolveComponent"])("UserHeader"),f=Object(r["resolveComponent"])("UserInfos");return e.user.username?(Object(r["openBlock"])(),Object(r["createBlock"])("div",o,[Object(r["createVNode"])(d,{user:e.user},null,8,["user"]),Object(r["createVNode"])("div",a,[Object(r["createVNode"])(f,{user:e.user,"from-admin":!0},null,8,["user"])])])):Object(r["createCommentVNode"])("",!0)})),u=c("6c02"),d=c("3c44"),f=c("71a7"),i=c("dad5"),b=c("2906"),p=Object(r["defineComponent"])({name:"UserView",components:{UserHeader:d["a"],UserInfos:f["a"]},setup:function(){var e=Object(u["c"])(),t=Object(b["a"])(),c=Object(r["computed"])((function(){return t.getters[i["d"].GETTERS.USER]}));return Object(r["onBeforeMount"])((function(){e.params.username&&"string"===typeof e.params.username&&t.dispatch(i["d"].ACTIONS.GET_USER,e.params.username)})),Object(r["onBeforeUnmount"])((function(){t.dispatch(i["d"].ACTIONS.EMPTY_USER)})),{user:c}}});c("7ffc");p.render=s,p.__scopeId="data-v-82f4bbf6";t["default"]=p},b288:function(e,t,c){},f1f4:function(e,t,c){"use strict";c("8f15")}}]);
|
|
||||||
//# sourceMappingURL=profile.998bc0bd.js.map
|
|
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/reset.624f741d.js
vendored
2
fittrackee/dist/static/js/reset.624f741d.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
fittrackee/dist/static/js/reset.ac1dbf71.js
vendored
Normal file
2
fittrackee/dist/static/js/reset.ac1dbf71.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
fittrackee/dist/static/js/reset.ac1dbf71.js.map
vendored
Normal file
1
fittrackee/dist/static/js/reset.ac1dbf71.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
fittrackee/dist/static/js/workouts.6316965e.js.map
vendored
Normal file
1
fittrackee/dist/static/js/workouts.6316965e.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
import { getApiUrl } from '@/utils'
|
import { getApiUrl } from '@/utils'
|
||||||
|
|
||||||
const authApi = axios.create({
|
const authApi = axios.create({
|
||||||
@ -10,7 +10,7 @@ const authApi = axios.create({
|
|||||||
|
|
||||||
authApi.interceptors.request.use(
|
authApi.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
const authToken = store.getters[USER_STORE.GETTERS.AUTH_TOKEN]
|
const authToken = store.getters[AUTH_USER_STORE.GETTERS.AUTH_TOKEN]
|
||||||
if (authToken) {
|
if (authToken) {
|
||||||
const auth = `Bearer ${authToken}`
|
const auth = `Bearer ${authToken}`
|
||||||
if (config.headers.Authorization !== auth) {
|
if (config.headers.Authorization !== auth) {
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
import FilterSelects from '@/components/Common/FilterSelects.vue'
|
import FilterSelects from '@/components/Common/FilterSelects.vue'
|
||||||
import Pagination from '@/components/Common/Pagination.vue'
|
import Pagination from '@/components/Common/Pagination.vue'
|
||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { ROOT_STORE, USER_STORE, USERS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE, USERS_STORE } from '@/store/constants'
|
||||||
import { IPagination, TPaginationPayload } from '@/types/api'
|
import { IPagination, TPaginationPayload } from '@/types/api'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
@ -163,7 +163,7 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const users: ComputedRef<IUserProfile[]> = computed(
|
const users: ComputedRef<IUserProfile[]> = computed(
|
||||||
() => store.getters[USERS_STORE.GETTERS.USERS]
|
() => store.getters[USERS_STORE.GETTERS.USERS]
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { IDropdownOption } from '@/types/forms'
|
import { IDropdownOption } from '@/types/forms'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
@ -100,10 +100,10 @@
|
|||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const isAuthenticated: ComputedRef<boolean> = computed(
|
const isAuthenticated: ComputedRef<boolean> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.IS_AUTHENTICATED]
|
() => store.getters[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED]
|
||||||
)
|
)
|
||||||
const authUserPictureUrl: ComputedRef<string> = computed(() =>
|
const authUserPictureUrl: ComputedRef<string> = computed(() =>
|
||||||
isAuthenticated.value && authUser.value.picture
|
isAuthenticated.value && authUser.value.picture
|
||||||
@ -130,7 +130,7 @@
|
|||||||
store.commit(ROOT_STORE.MUTATIONS.UPDATE_LANG, option.value)
|
store.commit(ROOT_STORE.MUTATIONS.UPDATE_LANG, option.value)
|
||||||
}
|
}
|
||||||
function logout() {
|
function logout() {
|
||||||
store.dispatch(USER_STORE.ACTIONS.LOGOUT)
|
store.dispatch(AUTH_USER_STORE.ACTIONS.LOGOUT)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
ref,
|
ref,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -73,7 +73,7 @@
|
|||||||
setup(props) {
|
setup(props) {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const registrationDate = computed(() =>
|
const registrationDate = computed(() =>
|
||||||
props.user.created_at
|
props.user.created_at
|
||||||
@ -91,7 +91,7 @@
|
|||||||
displayModal.value = value
|
displayModal.value = value
|
||||||
}
|
}
|
||||||
function deleteUserAccount(username: string) {
|
function deleteUserAccount(username: string) {
|
||||||
store.dispatch(USER_STORE.ACTIONS.DELETE_ACCOUNT, { username })
|
store.dispatch(AUTH_USER_STORE.ACTIONS.DELETE_ACCOUNT, { username })
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
onMounted,
|
onMounted,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { IUserProfile, IUserPayload } from '@/types/user'
|
import { IUserProfile, IUserPayload } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -135,7 +135,7 @@
|
|||||||
: ''
|
: ''
|
||||||
)
|
)
|
||||||
const loading = computed(
|
const loading = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.USER_LOADING]
|
() => store.getters[AUTH_USER_STORE.GETTERS.USER_LOADING]
|
||||||
)
|
)
|
||||||
const errorMessages: ComputedRef<string | string[] | null> = computed(
|
const errorMessages: ComputedRef<string | string[] | null> = computed(
|
||||||
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGES]
|
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGES]
|
||||||
@ -161,13 +161,13 @@
|
|||||||
userForm.bio = value
|
userForm.bio = value
|
||||||
}
|
}
|
||||||
function updateProfile() {
|
function updateProfile() {
|
||||||
store.dispatch(USER_STORE.ACTIONS.UPDATE_USER_PROFILE, userForm)
|
store.dispatch(AUTH_USER_STORE.ACTIONS.UPDATE_USER_PROFILE, userForm)
|
||||||
}
|
}
|
||||||
function updateDisplayModal(value: boolean) {
|
function updateDisplayModal(value: boolean) {
|
||||||
displayModal.value = value
|
displayModal.value = value
|
||||||
}
|
}
|
||||||
function deleteAccount(username: string) {
|
function deleteAccount(username: string) {
|
||||||
store.dispatch(USER_STORE.ACTIONS.DELETE_ACCOUNT, { username })
|
store.dispatch(AUTH_USER_STORE.ACTIONS.DELETE_ACCOUNT, { username })
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { TAppConfig } from '@/types/application'
|
import { TAppConfig } from '@/types/application'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
@ -69,7 +69,7 @@
|
|||||||
let pictureFile: Ref<File | null> = ref(null)
|
let pictureFile: Ref<File | null> = ref(null)
|
||||||
|
|
||||||
function deleteUserPicture() {
|
function deleteUserPicture() {
|
||||||
store.dispatch(USER_STORE.ACTIONS.DELETE_PICTURE)
|
store.dispatch(AUTH_USER_STORE.ACTIONS.DELETE_PICTURE)
|
||||||
}
|
}
|
||||||
function updatePictureFile(event: Event & { target: HTMLInputElement }) {
|
function updatePictureFile(event: Event & { target: HTMLInputElement }) {
|
||||||
if (event.target.files) {
|
if (event.target.files) {
|
||||||
@ -78,7 +78,7 @@
|
|||||||
}
|
}
|
||||||
function updateUserPicture() {
|
function updateUserPicture() {
|
||||||
if (pictureFile.value) {
|
if (pictureFile.value) {
|
||||||
store.dispatch(USER_STORE.ACTIONS.UPDATE_USER_PICTURE, {
|
store.dispatch(AUTH_USER_STORE.ACTIONS.UPDATE_USER_PICTURE, {
|
||||||
picture: pictureFile.value,
|
picture: pictureFile.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
onMounted,
|
onMounted,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { IUserProfile, IUserPreferencesPayload } from '@/types/user'
|
import { IUserProfile, IUserPreferencesPayload } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { availableLanguages } from '@/utils/locales'
|
import { availableLanguages } from '@/utils/locales'
|
||||||
@ -92,7 +92,7 @@
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
const loading = computed(
|
const loading = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.USER_LOADING]
|
() => store.getters[AUTH_USER_STORE.GETTERS.USER_LOADING]
|
||||||
)
|
)
|
||||||
const errorMessages: ComputedRef<string | string[] | null> = computed(
|
const errorMessages: ComputedRef<string | string[] | null> = computed(
|
||||||
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGES]
|
() => store.getters[ROOT_STORE.GETTERS.ERROR_MESSAGES]
|
||||||
@ -110,7 +110,10 @@
|
|||||||
userForm.weekm = user.weekm ? user.weekm : false
|
userForm.weekm = user.weekm ? user.weekm : false
|
||||||
}
|
}
|
||||||
function updateProfile() {
|
function updateProfile() {
|
||||||
store.dispatch(USER_STORE.ACTIONS.UPDATE_USER_PREFERENCES, userForm)
|
store.dispatch(
|
||||||
|
AUTH_USER_STORE.ACTIONS.UPDATE_USER_PREFERENCES,
|
||||||
|
userForm
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
import { computed, defineComponent, PropType } from 'vue'
|
import { computed, defineComponent, PropType } from 'vue'
|
||||||
|
|
||||||
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
|
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -43,7 +43,9 @@
|
|||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
return {
|
return {
|
||||||
loading: computed(() => store.getters[USER_STORE.GETTERS.USER_LOADING]),
|
loading: computed(
|
||||||
|
() => store.getters[AUTH_USER_STORE.GETTERS.USER_LOADING]
|
||||||
|
),
|
||||||
tabs: ['PROFILE', 'PICTURE', 'PREFERENCES'],
|
tabs: ['PROFILE', 'PICTURE', 'PREFERENCES'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
import { ComputedRef, computed, defineComponent, reactive, watch } from 'vue'
|
import { ComputedRef, computed, defineComponent, reactive, watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { TAppConfig } from '@/types/application'
|
import { TAppConfig } from '@/types/application'
|
||||||
import { ILoginRegisterFormData } from '@/types/user'
|
import { ILoginRegisterFormData } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
@ -140,20 +140,20 @@
|
|||||||
'user.INVALID_TOKEN'
|
'user.INVALID_TOKEN'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return store.dispatch(USER_STORE.ACTIONS.RESET_USER_PASSWORD, {
|
return store.dispatch(AUTH_USER_STORE.ACTIONS.RESET_USER_PASSWORD, {
|
||||||
password: formData.password,
|
password: formData.password,
|
||||||
password_conf: formData.password_conf,
|
password_conf: formData.password_conf,
|
||||||
token: props.token,
|
token: props.token,
|
||||||
})
|
})
|
||||||
case 'reset-request':
|
case 'reset-request':
|
||||||
return store.dispatch(
|
return store.dispatch(
|
||||||
USER_STORE.ACTIONS.SEND_PASSWORD_RESET_REQUEST,
|
AUTH_USER_STORE.ACTIONS.SEND_PASSWORD_RESET_REQUEST,
|
||||||
{
|
{
|
||||||
email: formData.email,
|
email: formData.email,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
store.dispatch(USER_STORE.ACTIONS.LOGIN_OR_REGISTER, {
|
store.dispatch(AUTH_USER_STORE.ACTIONS.LOGIN_OR_REGISTER, {
|
||||||
actionType,
|
actionType,
|
||||||
formData,
|
formData,
|
||||||
redirectUrl: route.query.from,
|
redirectUrl: route.query.from,
|
||||||
|
@ -12,7 +12,7 @@ import UserInfosEdition from '@/components/User/ProfileEdition/UserInfosEdition.
|
|||||||
import UserPictureEdition from '@/components/User/ProfileEdition/UserPictureEdition.vue'
|
import UserPictureEdition from '@/components/User/ProfileEdition/UserPictureEdition.vue'
|
||||||
import UserPreferencesEdition from '@/components/User/ProfileEdition/UserPreferencesEdition.vue'
|
import UserPreferencesEdition from '@/components/User/ProfileEdition/UserPreferencesEdition.vue'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
|
|
||||||
const getTabFromPath = (path: string): string => {
|
const getTabFromPath = (path: string): string => {
|
||||||
const regex = /(\/profile)(\/edit)*(\/*)/
|
const regex = /(\/profile)(\/edit)*(\/*)/
|
||||||
@ -238,15 +238,15 @@ const pathsWithoutAuthentication = [
|
|||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
store
|
store
|
||||||
.dispatch(USER_STORE.ACTIONS.CHECK_AUTH_USER)
|
.dispatch(AUTH_USER_STORE.ACTIONS.CHECK_AUTH_USER)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (
|
if (
|
||||||
store.getters[USER_STORE.GETTERS.IS_AUTHENTICATED] &&
|
store.getters[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED] &&
|
||||||
pathsWithoutAuthentication.includes(to.path)
|
pathsWithoutAuthentication.includes(to.path)
|
||||||
) {
|
) {
|
||||||
return next('/')
|
return next('/')
|
||||||
} else if (
|
} else if (
|
||||||
!store.getters[USER_STORE.GETTERS.IS_AUTHENTICATED] &&
|
!store.getters[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED] &&
|
||||||
!pathsWithoutAuthentication.includes(to.path)
|
!pathsWithoutAuthentication.includes(to.path)
|
||||||
) {
|
) {
|
||||||
const path =
|
const path =
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
import {
|
||||||
|
AuthUserActions,
|
||||||
|
AuthUserGetters,
|
||||||
|
AuthUserMutations,
|
||||||
|
} from '@/store/modules/authUser/enums'
|
||||||
import {
|
import {
|
||||||
RootActions,
|
RootActions,
|
||||||
RootGetters,
|
RootGetters,
|
||||||
@ -13,11 +18,6 @@ import {
|
|||||||
StatisticsGetters,
|
StatisticsGetters,
|
||||||
StatisticsMutations,
|
StatisticsMutations,
|
||||||
} from '@/store/modules/statistics/enums'
|
} from '@/store/modules/statistics/enums'
|
||||||
import {
|
|
||||||
UserActions,
|
|
||||||
UserGetters,
|
|
||||||
UserMutations,
|
|
||||||
} from '@/store/modules/user/enums'
|
|
||||||
import {
|
import {
|
||||||
UsersActions,
|
UsersActions,
|
||||||
UsersGetters,
|
UsersGetters,
|
||||||
@ -47,10 +47,10 @@ export const STATS_STORE = {
|
|||||||
MUTATIONS: StatisticsMutations,
|
MUTATIONS: StatisticsMutations,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const USER_STORE = {
|
export const AUTH_USER_STORE = {
|
||||||
ACTIONS: UserActions,
|
ACTIONS: AuthUserActions,
|
||||||
GETTERS: UserGetters,
|
GETTERS: AuthUserGetters,
|
||||||
MUTATIONS: UserMutations,
|
MUTATIONS: AuthUserMutations,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const USERS_STORE = {
|
export const USERS_STORE = {
|
||||||
|
@ -5,15 +5,18 @@ import api from '@/api/defaultApi'
|
|||||||
import createI18n from '@/i18n'
|
import createI18n from '@/i18n'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import {
|
import {
|
||||||
|
AUTH_USER_STORE,
|
||||||
ROOT_STORE,
|
ROOT_STORE,
|
||||||
SPORTS_STORE,
|
SPORTS_STORE,
|
||||||
STATS_STORE,
|
STATS_STORE,
|
||||||
USER_STORE,
|
|
||||||
USERS_STORE,
|
USERS_STORE,
|
||||||
WORKOUTS_STORE,
|
WORKOUTS_STORE,
|
||||||
} from '@/store/constants'
|
} from '@/store/constants'
|
||||||
|
import {
|
||||||
|
IAuthUserActions,
|
||||||
|
IAuthUserState,
|
||||||
|
} from '@/store/modules/authUser/types'
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
import { IUserActions, IUserState } from '@/store/modules/user/types'
|
|
||||||
import {
|
import {
|
||||||
ILoginOrRegisterData,
|
ILoginOrRegisterData,
|
||||||
IUserDeletionPayload,
|
IUserDeletionPayload,
|
||||||
@ -27,34 +30,37 @@ import { handleError } from '@/utils'
|
|||||||
|
|
||||||
const { locale } = createI18n.global
|
const { locale } = createI18n.global
|
||||||
|
|
||||||
const removeUserData = (context: ActionContext<IUserState, IRootState>) => {
|
const removeAuthUserData = (
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
|
) => {
|
||||||
localStorage.removeItem('authToken')
|
localStorage.removeItem('authToken')
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
context.commit(STATS_STORE.MUTATIONS.EMPTY_USER_STATS)
|
context.commit(STATS_STORE.MUTATIONS.EMPTY_USER_STATS)
|
||||||
context.commit(USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN)
|
context.commit(AUTH_USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN)
|
||||||
context.commit(USERS_STORE.MUTATIONS.UPDATE_USERS, [])
|
context.commit(USERS_STORE.MUTATIONS.UPDATE_USERS, [])
|
||||||
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS)
|
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS)
|
||||||
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT)
|
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT)
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
}
|
}
|
||||||
|
|
||||||
export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
export const actions: ActionTree<IAuthUserState, IRootState> &
|
||||||
[USER_STORE.ACTIONS.CHECK_AUTH_USER](
|
IAuthUserActions = {
|
||||||
context: ActionContext<IUserState, IRootState>
|
[AUTH_USER_STORE.ACTIONS.CHECK_AUTH_USER](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
): void {
|
): void {
|
||||||
if (
|
if (
|
||||||
window.localStorage.authToken &&
|
window.localStorage.authToken &&
|
||||||
!context.getters[USER_STORE.GETTERS.IS_AUTHENTICATED]
|
!context.getters[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED]
|
||||||
) {
|
) {
|
||||||
context.commit(
|
context.commit(
|
||||||
USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN,
|
AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN,
|
||||||
window.localStorage.authToken
|
window.localStorage.authToken
|
||||||
)
|
)
|
||||||
context.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
context.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.GET_USER_PROFILE](
|
[AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE](
|
||||||
context: ActionContext<IUserState, IRootState>
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
authApi
|
authApi
|
||||||
@ -62,7 +68,7 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.status === 'success') {
|
if (res.data.status === 'success') {
|
||||||
context.commit(
|
context.commit(
|
||||||
USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
|
AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
|
||||||
res.data.data
|
res.data.data
|
||||||
)
|
)
|
||||||
if (res.data.data.language) {
|
if (res.data.data.language) {
|
||||||
@ -75,16 +81,16 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
context.dispatch(SPORTS_STORE.ACTIONS.GET_SPORTS)
|
context.dispatch(SPORTS_STORE.ACTIONS.GET_SPORTS)
|
||||||
} else {
|
} else {
|
||||||
handleError(context, null)
|
handleError(context, null)
|
||||||
removeUserData(context)
|
removeAuthUserData(context)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
handleError(context, error)
|
handleError(context, error)
|
||||||
removeUserData(context)
|
removeAuthUserData(context)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.LOGIN_OR_REGISTER](
|
[AUTH_USER_STORE.ACTIONS.LOGIN_OR_REGISTER](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
data: ILoginOrRegisterData
|
data: ILoginOrRegisterData
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
@ -94,9 +100,9 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
if (res.data.status === 'success') {
|
if (res.data.status === 'success') {
|
||||||
const token = res.data.auth_token
|
const token = res.data.auth_token
|
||||||
window.localStorage.setItem('authToken', token)
|
window.localStorage.setItem('authToken', token)
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN, token)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN, token)
|
||||||
context
|
context
|
||||||
.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
.then(() =>
|
.then(() =>
|
||||||
router.push(
|
router.push(
|
||||||
typeof data.redirectUrl === 'string' ? data.redirectUrl : '/'
|
typeof data.redirectUrl === 'string' ? data.redirectUrl : '/'
|
||||||
@ -108,23 +114,23 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => handleError(context, error))
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.LOGOUT](
|
[AUTH_USER_STORE.ACTIONS.LOGOUT](
|
||||||
context: ActionContext<IUserState, IRootState>
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
): void {
|
): void {
|
||||||
removeUserData(context)
|
removeAuthUserData(context)
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.UPDATE_USER_PROFILE](
|
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_PROFILE](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
payload: IUserPayload
|
payload: IUserPayload
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
||||||
authApi
|
authApi
|
||||||
.post('auth/profile/edit', payload)
|
.post('auth/profile/edit', payload)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.status === 'success') {
|
if (res.data.status === 'success') {
|
||||||
context.commit(
|
context.commit(
|
||||||
USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
|
AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
|
||||||
res.data.data
|
res.data.data
|
||||||
)
|
)
|
||||||
router.push('/profile')
|
router.push('/profile')
|
||||||
@ -134,21 +140,21 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => handleError(context, error))
|
||||||
.finally(() =>
|
.finally(() =>
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.UPDATE_USER_PREFERENCES](
|
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_PREFERENCES](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
payload: IUserPreferencesPayload
|
payload: IUserPreferencesPayload
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
||||||
authApi
|
authApi
|
||||||
.post('auth/profile/edit/preferences', payload)
|
.post('auth/profile/edit/preferences', payload)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.status === 'success') {
|
if (res.data.status === 'success') {
|
||||||
context.commit(
|
context.commit(
|
||||||
USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
|
AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
|
||||||
res.data.data
|
res.data.data
|
||||||
)
|
)
|
||||||
context.commit(
|
context.commit(
|
||||||
@ -163,15 +169,15 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => handleError(context, error))
|
||||||
.finally(() =>
|
.finally(() =>
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.UPDATE_USER_PICTURE](
|
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_PICTURE](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
payload: IUserPicturePayload
|
payload: IUserPicturePayload
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
||||||
if (!payload.picture) {
|
if (!payload.picture) {
|
||||||
throw new Error('No file part')
|
throw new Error('No file part')
|
||||||
}
|
}
|
||||||
@ -186,7 +192,7 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.status === 'success') {
|
if (res.data.status === 'success') {
|
||||||
context
|
context
|
||||||
.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
.then(() => router.push('/profile'))
|
.then(() => router.push('/profile'))
|
||||||
} else {
|
} else {
|
||||||
handleError(context, null)
|
handleError(context, null)
|
||||||
@ -194,11 +200,11 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => handleError(context, error))
|
||||||
.finally(() =>
|
.finally(() =>
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.DELETE_ACCOUNT](
|
[AUTH_USER_STORE.ACTIONS.DELETE_ACCOUNT](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
payload: IUserDeletionPayload
|
payload: IUserDeletionPayload
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
@ -207,7 +213,7 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === 204) {
|
if (res.status === 204) {
|
||||||
context
|
context
|
||||||
.dispatch(USER_STORE.ACTIONS.LOGOUT)
|
.dispatch(AUTH_USER_STORE.ACTIONS.LOGOUT)
|
||||||
.then(() => router.push('/'))
|
.then(() => router.push('/'))
|
||||||
} else {
|
} else {
|
||||||
handleError(context, null)
|
handleError(context, null)
|
||||||
@ -215,17 +221,17 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => handleError(context, error))
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.DELETE_PICTURE](
|
[AUTH_USER_STORE.ACTIONS.DELETE_PICTURE](
|
||||||
context: ActionContext<IUserState, IRootState>
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, true)
|
||||||
authApi
|
authApi
|
||||||
.delete(`auth/picture`)
|
.delete(`auth/picture`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === 204) {
|
if (res.status === 204) {
|
||||||
context
|
context
|
||||||
.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
.then(() => router.push('/profile'))
|
.then(() => router.push('/profile'))
|
||||||
} else {
|
} else {
|
||||||
handleError(context, null)
|
handleError(context, null)
|
||||||
@ -233,11 +239,11 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => handleError(context, error))
|
||||||
.finally(() =>
|
.finally(() =>
|
||||||
context.commit(USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
context.commit(AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING, false)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.SEND_PASSWORD_RESET_REQUEST](
|
[AUTH_USER_STORE.ACTIONS.SEND_PASSWORD_RESET_REQUEST](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
payload: IUserPasswordPayload
|
payload: IUserPasswordPayload
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
||||||
@ -252,8 +258,8 @@ export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
|||||||
})
|
})
|
||||||
.catch((error) => handleError(context, error))
|
.catch((error) => handleError(context, error))
|
||||||
},
|
},
|
||||||
[USER_STORE.ACTIONS.RESET_USER_PASSWORD](
|
[AUTH_USER_STORE.ACTIONS.RESET_USER_PASSWORD](
|
||||||
context: ActionContext<IUserState, IRootState>,
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
payload: IUserPasswordResetPayload
|
payload: IUserPasswordResetPayload
|
||||||
): void {
|
): void {
|
||||||
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
|
@ -1,4 +1,4 @@
|
|||||||
export enum UserActions {
|
export enum AuthUserActions {
|
||||||
CHECK_AUTH_USER = 'CHECK_AUTH_USER',
|
CHECK_AUTH_USER = 'CHECK_AUTH_USER',
|
||||||
DELETE_ACCOUNT = 'DELETE_ACCOUNT',
|
DELETE_ACCOUNT = 'DELETE_ACCOUNT',
|
||||||
DELETE_PICTURE = 'DELETE_PICTURE',
|
DELETE_PICTURE = 'DELETE_PICTURE',
|
||||||
@ -12,7 +12,7 @@ export enum UserActions {
|
|||||||
UPDATE_USER_PREFERENCES = 'UPDATE_USER_PREFERENCES',
|
UPDATE_USER_PREFERENCES = 'UPDATE_USER_PREFERENCES',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum UserGetters {
|
export enum AuthUserGetters {
|
||||||
AUTH_TOKEN = 'AUTH_TOKEN',
|
AUTH_TOKEN = 'AUTH_TOKEN',
|
||||||
AUTH_USER_PROFILE = 'AUTH_USER_PROFILE',
|
AUTH_USER_PROFILE = 'AUTH_USER_PROFILE',
|
||||||
IS_ADMIN = 'IS_ADMIN',
|
IS_ADMIN = 'IS_ADMIN',
|
||||||
@ -20,7 +20,7 @@ export enum UserGetters {
|
|||||||
USER_LOADING = 'USER_LOADING',
|
USER_LOADING = 'USER_LOADING',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum UserMutations {
|
export enum AuthUserMutations {
|
||||||
CLEAR_AUTH_USER_TOKEN = 'CLEAR_AUTH_USER_TOKEN',
|
CLEAR_AUTH_USER_TOKEN = 'CLEAR_AUTH_USER_TOKEN',
|
||||||
UPDATE_AUTH_TOKEN = 'UPDATE_AUTH_TOKEN',
|
UPDATE_AUTH_TOKEN = 'UPDATE_AUTH_TOKEN',
|
||||||
UPDATE_AUTH_USER_PROFILE = 'UPDATE_AUTH_USER_PROFILE',
|
UPDATE_AUTH_USER_PROFILE = 'UPDATE_AUTH_USER_PROFILE',
|
27
fittrackee_client/src/store/modules/authUser/getters.ts
Normal file
27
fittrackee_client/src/store/modules/authUser/getters.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { GetterTree } from 'vuex'
|
||||||
|
|
||||||
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
|
import {
|
||||||
|
IAuthUserGetters,
|
||||||
|
IAuthUserState,
|
||||||
|
} from '@/store/modules/authUser/types'
|
||||||
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
|
|
||||||
|
export const getters: GetterTree<IAuthUserState, IRootState> &
|
||||||
|
IAuthUserGetters = {
|
||||||
|
[AUTH_USER_STORE.GETTERS.AUTH_TOKEN]: (state: IAuthUserState) => {
|
||||||
|
return state.authToken
|
||||||
|
},
|
||||||
|
[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]: (state: IAuthUserState) => {
|
||||||
|
return state.authUserProfile
|
||||||
|
},
|
||||||
|
[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED]: (state: IAuthUserState) => {
|
||||||
|
return state.authToken !== null
|
||||||
|
},
|
||||||
|
[AUTH_USER_STORE.GETTERS.IS_ADMIN]: (state: IAuthUserState) => {
|
||||||
|
return state.authUserProfile && state.authUserProfile.admin
|
||||||
|
},
|
||||||
|
[AUTH_USER_STORE.GETTERS.USER_LOADING]: (state: IAuthUserState) => {
|
||||||
|
return state.loading
|
||||||
|
},
|
||||||
|
}
|
17
fittrackee_client/src/store/modules/authUser/index.ts
Normal file
17
fittrackee_client/src/store/modules/authUser/index.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { Module } from 'vuex'
|
||||||
|
|
||||||
|
import { actions } from '@/store/modules/authUser/actions'
|
||||||
|
import { getters } from '@/store/modules/authUser/getters'
|
||||||
|
import { mutations } from '@/store/modules/authUser/mutations'
|
||||||
|
import { authUserState } from '@/store/modules/authUser/state.ts'
|
||||||
|
import { IAuthUserState } from '@/store/modules/authUser/types'
|
||||||
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
|
|
||||||
|
const authUser: Module<IAuthUserState, IRootState> = {
|
||||||
|
state: authUserState,
|
||||||
|
actions,
|
||||||
|
getters,
|
||||||
|
mutations,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default authUser
|
33
fittrackee_client/src/store/modules/authUser/mutations.ts
Normal file
33
fittrackee_client/src/store/modules/authUser/mutations.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { MutationTree } from 'vuex'
|
||||||
|
|
||||||
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
|
import {
|
||||||
|
IAuthUserState,
|
||||||
|
TAuthUserMutations,
|
||||||
|
} from '@/store/modules/authUser/types'
|
||||||
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
|
export const mutations: MutationTree<IAuthUserState> & TAuthUserMutations = {
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IAuthUserState) {
|
||||||
|
state.authToken = null
|
||||||
|
state.authUserProfile = <IUserProfile>{}
|
||||||
|
},
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
|
||||||
|
state: IAuthUserState,
|
||||||
|
authToken: string
|
||||||
|
) {
|
||||||
|
state.authToken = authToken
|
||||||
|
},
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
||||||
|
state: IAuthUserState,
|
||||||
|
authUserProfile: IUserProfile
|
||||||
|
) {
|
||||||
|
state.authUserProfile = authUserProfile
|
||||||
|
},
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING](
|
||||||
|
state: IAuthUserState,
|
||||||
|
loading: boolean
|
||||||
|
) {
|
||||||
|
state.loading = loading
|
||||||
|
},
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
import { IUserState } from '@/store/modules/user/types'
|
import { IAuthUserState } from '@/store/modules/authUser/types'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export const userState: IUserState = {
|
export const authUserState: IAuthUserState = {
|
||||||
authToken: null,
|
authToken: null,
|
||||||
authUserProfile: <IUserProfile>{},
|
authUserProfile: <IUserProfile>{},
|
||||||
loading: false,
|
loading: false,
|
132
fittrackee_client/src/store/modules/authUser/types.ts
Normal file
132
fittrackee_client/src/store/modules/authUser/types.ts
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
import {
|
||||||
|
ActionContext,
|
||||||
|
CommitOptions,
|
||||||
|
DispatchOptions,
|
||||||
|
Store as VuexStore,
|
||||||
|
} from 'vuex'
|
||||||
|
|
||||||
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
|
import {
|
||||||
|
IUserProfile,
|
||||||
|
ILoginOrRegisterData,
|
||||||
|
IUserDeletionPayload,
|
||||||
|
IUserPasswordPayload,
|
||||||
|
IUserPasswordResetPayload,
|
||||||
|
IUserPayload,
|
||||||
|
IUserPicturePayload,
|
||||||
|
IUserPreferencesPayload,
|
||||||
|
} from '@/types/user'
|
||||||
|
|
||||||
|
export interface IAuthUserState {
|
||||||
|
authToken: string | null
|
||||||
|
authUserProfile: IUserProfile
|
||||||
|
loading: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IAuthUserActions {
|
||||||
|
[AUTH_USER_STORE.ACTIONS.CHECK_AUTH_USER](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.LOGIN_OR_REGISTER](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
|
data: ILoginOrRegisterData
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.LOGOUT](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_PROFILE](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
|
payload: IUserPayload
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_PREFERENCES](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
|
payload: IUserPreferencesPayload
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.UPDATE_USER_PICTURE](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
|
payload: IUserPicturePayload
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.SEND_PASSWORD_RESET_REQUEST](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
|
payload: IUserPasswordPayload
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.RESET_USER_PASSWORD](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
|
payload: IUserPasswordResetPayload
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.DELETE_ACCOUNT](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>,
|
||||||
|
payload: IUserDeletionPayload
|
||||||
|
): void
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.ACTIONS.DELETE_PICTURE](
|
||||||
|
context: ActionContext<IAuthUserState, IRootState>
|
||||||
|
): void
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IAuthUserGetters {
|
||||||
|
[AUTH_USER_STORE.GETTERS.AUTH_TOKEN](state: IAuthUserState): string | null
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE](
|
||||||
|
state: IAuthUserState
|
||||||
|
): IUserProfile
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.GETTERS.IS_ADMIN](state: IAuthUserState): boolean
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.GETTERS.IS_AUTHENTICATED](state: IAuthUserState): boolean
|
||||||
|
|
||||||
|
[AUTH_USER_STORE.GETTERS.USER_LOADING](state: IAuthUserState): boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TAuthUserMutations<S = IAuthUserState> = {
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: S): void
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
|
||||||
|
state: S,
|
||||||
|
authToken: string
|
||||||
|
): void
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
||||||
|
state: S,
|
||||||
|
authUserProfile: IUserProfile
|
||||||
|
): void
|
||||||
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_USER_LOADING](
|
||||||
|
state: S,
|
||||||
|
loading: boolean
|
||||||
|
): void
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TAuthUserStoreModule<S = IAuthUserState> = Omit<
|
||||||
|
VuexStore<S>,
|
||||||
|
'commit' | 'getters' | 'dispatch'
|
||||||
|
> & {
|
||||||
|
dispatch<K extends keyof IAuthUserActions>(
|
||||||
|
key: K,
|
||||||
|
payload?: Parameters<IAuthUserActions[K]>[1],
|
||||||
|
options?: DispatchOptions
|
||||||
|
): ReturnType<IAuthUserActions[K]>
|
||||||
|
} & {
|
||||||
|
getters: {
|
||||||
|
[K in keyof IAuthUserGetters]: ReturnType<IAuthUserGetters[K]>
|
||||||
|
}
|
||||||
|
} & {
|
||||||
|
commit<
|
||||||
|
K extends keyof TAuthUserMutations,
|
||||||
|
P extends Parameters<TAuthUserMutations[K]>[1]
|
||||||
|
>(
|
||||||
|
key: K,
|
||||||
|
payload?: P,
|
||||||
|
options?: CommitOptions
|
||||||
|
): ReturnType<TAuthUserMutations[K]>
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import { Module, ModuleTree } from 'vuex'
|
import { Module, ModuleTree } from 'vuex'
|
||||||
|
|
||||||
|
import authUserModule from '@/store/modules/authUser'
|
||||||
import { actions } from '@/store/modules/root/actions'
|
import { actions } from '@/store/modules/root/actions'
|
||||||
import { getters } from '@/store/modules/root/getters'
|
import { getters } from '@/store/modules/root/getters'
|
||||||
import { mutations } from '@/store/modules/root/mutations'
|
import { mutations } from '@/store/modules/root/mutations'
|
||||||
@ -7,14 +8,13 @@ import { state } from '@/store/modules/root/state.ts'
|
|||||||
import { IRootState } from '@/store/modules/root/types'
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
import sportsModule from '@/store/modules/sports'
|
import sportsModule from '@/store/modules/sports'
|
||||||
import statsModule from '@/store/modules/statistics'
|
import statsModule from '@/store/modules/statistics'
|
||||||
import userModule from '@/store/modules/user'
|
|
||||||
import usersModule from '@/store/modules/users'
|
import usersModule from '@/store/modules/users'
|
||||||
import workoutsModule from '@/store/modules/workouts'
|
import workoutsModule from '@/store/modules/workouts'
|
||||||
|
|
||||||
const modules: ModuleTree<IRootState> = {
|
const modules: ModuleTree<IRootState> = {
|
||||||
|
authUserModule,
|
||||||
sportsModule,
|
sportsModule,
|
||||||
statsModule,
|
statsModule,
|
||||||
userModule,
|
|
||||||
usersModule,
|
usersModule,
|
||||||
workoutsModule,
|
workoutsModule,
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
import { GetterTree } from 'vuex'
|
|
||||||
|
|
||||||
import { USER_STORE } from '@/store/constants'
|
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
|
||||||
import { IUserGetters, IUserState } from '@/store/modules/user/types'
|
|
||||||
|
|
||||||
export const getters: GetterTree<IUserState, IRootState> & IUserGetters = {
|
|
||||||
[USER_STORE.GETTERS.AUTH_TOKEN]: (state: IUserState) => {
|
|
||||||
return state.authToken
|
|
||||||
},
|
|
||||||
[USER_STORE.GETTERS.AUTH_USER_PROFILE]: (state: IUserState) => {
|
|
||||||
return state.authUserProfile
|
|
||||||
},
|
|
||||||
[USER_STORE.GETTERS.IS_AUTHENTICATED]: (state: IUserState) => {
|
|
||||||
return state.authToken !== null
|
|
||||||
},
|
|
||||||
[USER_STORE.GETTERS.IS_ADMIN]: (state: IUserState) => {
|
|
||||||
return state.authUserProfile && state.authUserProfile.admin
|
|
||||||
},
|
|
||||||
[USER_STORE.GETTERS.USER_LOADING]: (state: IUserState) => {
|
|
||||||
return state.loading
|
|
||||||
},
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
import { Module } from 'vuex'
|
|
||||||
|
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
|
||||||
import { actions } from '@/store/modules/user/actions'
|
|
||||||
import { getters } from '@/store/modules/user/getters'
|
|
||||||
import { mutations } from '@/store/modules/user/mutations'
|
|
||||||
import { userState } from '@/store/modules/user/state.ts'
|
|
||||||
import { IUserState } from '@/store/modules/user/types'
|
|
||||||
|
|
||||||
const user: Module<IUserState, IRootState> = {
|
|
||||||
state: userState,
|
|
||||||
actions,
|
|
||||||
getters,
|
|
||||||
mutations,
|
|
||||||
}
|
|
||||||
|
|
||||||
export default user
|
|
@ -1,30 +0,0 @@
|
|||||||
import { MutationTree } from 'vuex'
|
|
||||||
|
|
||||||
import { USER_STORE } from '@/store/constants'
|
|
||||||
import { IUserState, TUserMutations } from '@/store/modules/user/types'
|
|
||||||
import { IUserProfile } from '@/types/user'
|
|
||||||
|
|
||||||
export const mutations: MutationTree<IUserState> & TUserMutations = {
|
|
||||||
[USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IUserState) {
|
|
||||||
state.authToken = null
|
|
||||||
state.authUserProfile = <IUserProfile>{}
|
|
||||||
},
|
|
||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
|
|
||||||
state: IUserState,
|
|
||||||
authToken: string
|
|
||||||
) {
|
|
||||||
state.authToken = authToken
|
|
||||||
},
|
|
||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
|
||||||
state: IUserState,
|
|
||||||
authUserProfile: IUserProfile
|
|
||||||
) {
|
|
||||||
state.authUserProfile = authUserProfile
|
|
||||||
},
|
|
||||||
[USER_STORE.MUTATIONS.UPDATE_USER_LOADING](
|
|
||||||
state: IUserState,
|
|
||||||
loading: boolean
|
|
||||||
) {
|
|
||||||
state.loading = loading
|
|
||||||
},
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
import {
|
|
||||||
ActionContext,
|
|
||||||
CommitOptions,
|
|
||||||
DispatchOptions,
|
|
||||||
Store as VuexStore,
|
|
||||||
} from 'vuex'
|
|
||||||
|
|
||||||
import { USER_STORE } from '@/store/constants'
|
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
|
||||||
import {
|
|
||||||
IUserProfile,
|
|
||||||
ILoginOrRegisterData,
|
|
||||||
IUserDeletionPayload,
|
|
||||||
IUserPasswordPayload,
|
|
||||||
IUserPasswordResetPayload,
|
|
||||||
IUserPayload,
|
|
||||||
IUserPicturePayload,
|
|
||||||
IUserPreferencesPayload,
|
|
||||||
} from '@/types/user'
|
|
||||||
|
|
||||||
export interface IUserState {
|
|
||||||
authToken: string | null
|
|
||||||
authUserProfile: IUserProfile
|
|
||||||
loading: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IUserActions {
|
|
||||||
[USER_STORE.ACTIONS.CHECK_AUTH_USER](
|
|
||||||
context: ActionContext<IUserState, IRootState>
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.GET_USER_PROFILE](
|
|
||||||
context: ActionContext<IUserState, IRootState>
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.LOGIN_OR_REGISTER](
|
|
||||||
context: ActionContext<IUserState, IRootState>,
|
|
||||||
data: ILoginOrRegisterData
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.LOGOUT](
|
|
||||||
context: ActionContext<IUserState, IRootState>
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.UPDATE_USER_PROFILE](
|
|
||||||
context: ActionContext<IUserState, IRootState>,
|
|
||||||
payload: IUserPayload
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.UPDATE_USER_PREFERENCES](
|
|
||||||
context: ActionContext<IUserState, IRootState>,
|
|
||||||
payload: IUserPreferencesPayload
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.UPDATE_USER_PICTURE](
|
|
||||||
context: ActionContext<IUserState, IRootState>,
|
|
||||||
payload: IUserPicturePayload
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.SEND_PASSWORD_RESET_REQUEST](
|
|
||||||
context: ActionContext<IUserState, IRootState>,
|
|
||||||
payload: IUserPasswordPayload
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.RESET_USER_PASSWORD](
|
|
||||||
context: ActionContext<IUserState, IRootState>,
|
|
||||||
payload: IUserPasswordResetPayload
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.DELETE_ACCOUNT](
|
|
||||||
context: ActionContext<IUserState, IRootState>,
|
|
||||||
payload: IUserDeletionPayload
|
|
||||||
): void
|
|
||||||
|
|
||||||
[USER_STORE.ACTIONS.DELETE_PICTURE](
|
|
||||||
context: ActionContext<IUserState, IRootState>
|
|
||||||
): void
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IUserGetters {
|
|
||||||
[USER_STORE.GETTERS.AUTH_TOKEN](state: IUserState): string | null
|
|
||||||
|
|
||||||
[USER_STORE.GETTERS.AUTH_USER_PROFILE](state: IUserState): IUserProfile
|
|
||||||
|
|
||||||
[USER_STORE.GETTERS.IS_ADMIN](state: IUserState): boolean
|
|
||||||
|
|
||||||
[USER_STORE.GETTERS.IS_AUTHENTICATED](state: IUserState): boolean
|
|
||||||
|
|
||||||
[USER_STORE.GETTERS.USER_LOADING](state: IUserState): boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TUserMutations<S = IUserState> = {
|
|
||||||
[USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: S): void
|
|
||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](state: S, authToken: string): void
|
|
||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
|
||||||
state: S,
|
|
||||||
authUserProfile: IUserProfile
|
|
||||||
): void
|
|
||||||
[USER_STORE.MUTATIONS.UPDATE_USER_LOADING](state: S, loading: boolean): void
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TUserStoreModule<S = IUserState> = Omit<
|
|
||||||
VuexStore<S>,
|
|
||||||
'commit' | 'getters' | 'dispatch'
|
|
||||||
> & {
|
|
||||||
dispatch<K extends keyof IUserActions>(
|
|
||||||
key: K,
|
|
||||||
payload?: Parameters<IUserActions[K]>[1],
|
|
||||||
options?: DispatchOptions
|
|
||||||
): ReturnType<IUserActions[K]>
|
|
||||||
} & {
|
|
||||||
getters: {
|
|
||||||
[K in keyof IUserGetters]: ReturnType<IUserGetters[K]>
|
|
||||||
}
|
|
||||||
} & {
|
|
||||||
commit<
|
|
||||||
K extends keyof TUserMutations,
|
|
||||||
P extends Parameters<TUserMutations[K]>[1]
|
|
||||||
>(
|
|
||||||
key: K,
|
|
||||||
payload?: P,
|
|
||||||
options?: CommitOptions
|
|
||||||
): ReturnType<TUserMutations[K]>
|
|
||||||
}
|
|
@ -2,7 +2,7 @@ import { ActionContext, ActionTree } from 'vuex'
|
|||||||
|
|
||||||
import authApi from '@/api/authApi'
|
import authApi from '@/api/authApi'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { ROOT_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import { ROOT_STORE, AUTH_USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
import { WorkoutsMutations } from '@/store/modules/workouts/enums'
|
import { WorkoutsMutations } from '@/store/modules/workouts/enums'
|
||||||
import {
|
import {
|
||||||
@ -138,7 +138,7 @@ export const actions: ActionTree<IWorkoutsState, IRootState> &
|
|||||||
.delete(`workouts/${payload.workoutId}`)
|
.delete(`workouts/${payload.workoutId}`)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT)
|
context.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUT)
|
||||||
context.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
context.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
router.push('/')
|
router.push('/')
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -157,7 +157,7 @@ export const actions: ActionTree<IWorkoutsState, IRootState> &
|
|||||||
authApi
|
authApi
|
||||||
.patch(`workouts/${payload.workoutId}`, payload.data)
|
.patch(`workouts/${payload.workoutId}`, payload.data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
context.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
context.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
context
|
context
|
||||||
.dispatch(WORKOUTS_STORE.ACTIONS.GET_WORKOUT_DATA, {
|
.dispatch(WORKOUTS_STORE.ACTIONS.GET_WORKOUT_DATA, {
|
||||||
workoutId: payload.workoutId,
|
workoutId: payload.workoutId,
|
||||||
@ -199,7 +199,7 @@ export const actions: ActionTree<IWorkoutsState, IRootState> &
|
|||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.status === 'created') {
|
if (res.data.status === 'created') {
|
||||||
context.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
context.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
const workout: IWorkout = res.data.data.workouts[0]
|
const workout: IWorkout = res.data.data.workouts[0]
|
||||||
router.push(
|
router.push(
|
||||||
res.data.data.workouts.length === 1
|
res.data.data.workouts.length === 1
|
||||||
@ -225,7 +225,7 @@ export const actions: ActionTree<IWorkoutsState, IRootState> &
|
|||||||
.post('workouts/no_gpx', payload)
|
.post('workouts/no_gpx', payload)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.status === 'created') {
|
if (res.data.status === 'created') {
|
||||||
context.dispatch(USER_STORE.ACTIONS.GET_USER_PROFILE)
|
context.dispatch(AUTH_USER_STORE.ACTIONS.GET_USER_PROFILE)
|
||||||
const workout: IWorkout = res.data.data.workouts[0]
|
const workout: IWorkout = res.data.data.workouts[0]
|
||||||
router.push(`/workouts/${workout.id}`)
|
router.push(`/workouts/${workout.id}`)
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
|
import { TAuthUserStoreModule } from '@/store/modules/authUser/types'
|
||||||
import { TRootStoreModule } from '@/store/modules/root/types'
|
import { TRootStoreModule } from '@/store/modules/root/types'
|
||||||
import { TSportsStoreModule } from '@/store/modules/sports/types'
|
import { TSportsStoreModule } from '@/store/modules/sports/types'
|
||||||
import { TStatisticsStoreModule } from '@/store/modules/statistics/types'
|
import { TStatisticsStoreModule } from '@/store/modules/statistics/types'
|
||||||
import { TUserStoreModule } from '@/store/modules/user/types'
|
|
||||||
import { TUsersStoreModule } from '@/store/modules/users/types'
|
import { TUsersStoreModule } from '@/store/modules/users/types'
|
||||||
import { TWorkoutsStoreModule } from '@/store/modules/workouts/types'
|
import { TWorkoutsStoreModule } from '@/store/modules/workouts/types'
|
||||||
|
|
||||||
type StoreModules = {
|
type StoreModules = {
|
||||||
|
authUserModule: TAuthUserStoreModule
|
||||||
rootModule: TRootStoreModule
|
rootModule: TRootStoreModule
|
||||||
sportsModule: TSportsStoreModule
|
sportsModule: TSportsStoreModule
|
||||||
statsModule: TStatisticsStoreModule
|
statsModule: TStatisticsStoreModule
|
||||||
userModule: TUserStoreModule
|
|
||||||
usersModule: TUsersStoreModule
|
usersModule: TUsersStoreModule
|
||||||
workoutsModule: TWorkoutsStoreModule
|
workoutsModule: TWorkoutsStoreModule
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Store = TUserStoreModule<Pick<StoreModules, 'userModule'>> &
|
export type Store = TAuthUserStoreModule<Pick<StoreModules, 'authUserModule'>> &
|
||||||
TSportsStoreModule<Pick<StoreModules, 'sportsModule'>> &
|
TSportsStoreModule<Pick<StoreModules, 'sportsModule'>> &
|
||||||
TStatisticsStoreModule<Pick<StoreModules, 'statsModule'>> &
|
TStatisticsStoreModule<Pick<StoreModules, 'statsModule'>> &
|
||||||
TWorkoutsStoreModule<Pick<StoreModules, 'workoutsModule'>> &
|
TWorkoutsStoreModule<Pick<StoreModules, 'workoutsModule'>> &
|
||||||
|
@ -2,10 +2,10 @@ import { AxiosError } from 'axios'
|
|||||||
import { ActionContext } from 'vuex'
|
import { ActionContext } from 'vuex'
|
||||||
|
|
||||||
import { ROOT_STORE } from '@/store/constants'
|
import { ROOT_STORE } from '@/store/constants'
|
||||||
|
import { IAuthUserState } from '@/store/modules/authUser/types'
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
import { ISportsState } from '@/store/modules/sports/types'
|
import { ISportsState } from '@/store/modules/sports/types'
|
||||||
import { IStatisticsState } from '@/store/modules/statistics/types'
|
import { IStatisticsState } from '@/store/modules/statistics/types'
|
||||||
import { IUserState } from '@/store/modules/user/types'
|
|
||||||
import { IUsersState } from '@/store/modules/users/types'
|
import { IUsersState } from '@/store/modules/users/types'
|
||||||
import { IWorkoutsState } from '@/store/modules/workouts/types'
|
import { IWorkoutsState } from '@/store/modules/workouts/types'
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ export const getApiUrl = (): string => {
|
|||||||
export const handleError = (
|
export const handleError = (
|
||||||
context:
|
context:
|
||||||
| ActionContext<IRootState, IRootState>
|
| ActionContext<IRootState, IRootState>
|
||||||
| ActionContext<IUserState, IRootState>
|
| ActionContext<IAuthUserState, IRootState>
|
||||||
| ActionContext<IStatisticsState, IRootState>
|
| ActionContext<IStatisticsState, IRootState>
|
||||||
| ActionContext<ISportsState, IRootState>
|
| ActionContext<ISportsState, IRootState>
|
||||||
| ActionContext<IUsersState, IRootState>
|
| ActionContext<IUsersState, IRootState>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import { computed, ComputedRef, defineComponent, onBeforeMount } from 'vue'
|
import { computed, ComputedRef, defineComponent, onBeforeMount } from 'vue'
|
||||||
|
|
||||||
import NotFound from '@/components/Common/NotFound.vue'
|
import NotFound from '@/components/Common/NotFound.vue'
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { TAppConfig, IAppStatistics } from '@/types/application'
|
import { TAppConfig, IAppStatistics } from '@/types/application'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -42,10 +42,10 @@
|
|||||||
() => store.getters[ROOT_STORE.GETTERS.APP_STATS]
|
() => store.getters[ROOT_STORE.GETTERS.APP_STATS]
|
||||||
)
|
)
|
||||||
const isAuthUserAmin: ComputedRef<boolean> = computed(
|
const isAuthUserAmin: ComputedRef<boolean> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.IS_ADMIN]
|
() => store.getters[AUTH_USER_STORE.GETTERS.IS_ADMIN]
|
||||||
)
|
)
|
||||||
const userLoading: ComputedRef<boolean> = computed(
|
const userLoading: ComputedRef<boolean> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.USER_LOADING]
|
() => store.getters[AUTH_USER_STORE.GETTERS.USER_LOADING]
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
import UserMonthStats from '@/components/Dashboard/UserMonthStats.vue'
|
import UserMonthStats from '@/components/Dashboard/UserMonthStats.vue'
|
||||||
import UserRecords from '@/components/Dashboard/UserRecords/index.vue'
|
import UserRecords from '@/components/Dashboard/UserRecords/index.vue'
|
||||||
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
|
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
|
||||||
import { SPORTS_STORE, USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
@ -97,7 +97,7 @@
|
|||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
import Statistics from '@/components/Statistics/index.vue'
|
import Statistics from '@/components/Statistics/index.vue'
|
||||||
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
||||||
import { USER_STORE, SPORTS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
@ -35,7 +35,7 @@
|
|||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(() =>
|
const sports: ComputedRef<ISport[]> = computed(() =>
|
||||||
store.getters[SPORTS_STORE.GETTERS.SPORTS].filter((sport) =>
|
store.getters[SPORTS_STORE.GETTERS.SPORTS].filter((sport) =>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, ComputedRef, defineComponent } from 'vue'
|
import { computed, ComputedRef, defineComponent } from 'vue'
|
||||||
|
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
return { authUser }
|
return { authUser }
|
||||||
},
|
},
|
||||||
|
@ -15,7 +15,11 @@
|
|||||||
import { computed, defineComponent, ComputedRef } from 'vue'
|
import { computed, defineComponent, ComputedRef } from 'vue'
|
||||||
|
|
||||||
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
||||||
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import {
|
||||||
|
AUTH_USER_STORE,
|
||||||
|
SPORTS_STORE,
|
||||||
|
WORKOUTS_STORE,
|
||||||
|
} from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData } from '@/types/workouts'
|
import { IWorkoutData } from '@/types/workouts'
|
||||||
@ -32,7 +36,7 @@
|
|||||||
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
||||||
)
|
)
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const workoutData: ComputedRef<IWorkoutData> = computed(
|
const workoutData: ComputedRef<IWorkoutData> = computed(
|
||||||
() => store.getters[WORKOUTS_STORE.GETTERS.WORKOUT_DATA]
|
() => store.getters[WORKOUTS_STORE.GETTERS.WORKOUT_DATA]
|
||||||
|
@ -22,7 +22,11 @@
|
|||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
||||||
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import {
|
||||||
|
AUTH_USER_STORE,
|
||||||
|
SPORTS_STORE,
|
||||||
|
WORKOUTS_STORE,
|
||||||
|
} from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData } from '@/types/workouts'
|
import { IWorkoutData } from '@/types/workouts'
|
||||||
@ -44,7 +48,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
||||||
|
@ -55,7 +55,11 @@
|
|||||||
import WorkoutDetail from '@/components/Workout/WorkoutDetail/index.vue'
|
import WorkoutDetail from '@/components/Workout/WorkoutDetail/index.vue'
|
||||||
import WorkoutNotes from '@/components/Workout/WorkoutNotes.vue'
|
import WorkoutNotes from '@/components/Workout/WorkoutNotes.vue'
|
||||||
import WorkoutSegments from '@/components/Workout/WorkoutSegments.vue'
|
import WorkoutSegments from '@/components/Workout/WorkoutSegments.vue'
|
||||||
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import {
|
||||||
|
AUTH_USER_STORE,
|
||||||
|
SPORTS_STORE,
|
||||||
|
WORKOUTS_STORE,
|
||||||
|
} from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData, IWorkoutPayload, TCoordinates } from '@/types/workouts'
|
import { IWorkoutData, IWorkoutPayload, TCoordinates } from '@/types/workouts'
|
||||||
@ -92,7 +96,7 @@
|
|||||||
() => store.getters[WORKOUTS_STORE.GETTERS.WORKOUT_DATA]
|
() => store.getters[WORKOUTS_STORE.GETTERS.WORKOUT_DATA]
|
||||||
)
|
)
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
import WorkoutsFilters from '@/components/Workouts/WorkoutsFilters.vue'
|
import WorkoutsFilters from '@/components/Workouts/WorkoutsFilters.vue'
|
||||||
import WorkoutsList from '@/components/Workouts/WorkoutsList.vue'
|
import WorkoutsList from '@/components/Workouts/WorkoutsList.vue'
|
||||||
import { USER_STORE, SPORTS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport, ITranslatedSport } from '@/types/sports'
|
import { ISport, ITranslatedSport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
@ -48,7 +48,7 @@
|
|||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
||||||
|
Loading…
Reference in New Issue
Block a user