diff --git a/src/App.vue b/src/App.vue index 7e4cd28..6020bf4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -23,8 +23,8 @@ export default { const jwt = localStorage.getItem("token"); const wind = localStorage.getItem("wind404"); - if (token) { - this.$store.commit("setToken", token); + if (jwt) { + this.$store.commit("setToken", jwt); } if (wind) { @@ -33,6 +33,10 @@ export default { this.$store.commit("setWind", wind); } + Object.assign(axios.defaults, { + headers: { Authorization: this.$store.state.user.token }, + }); + if (this.$store.state.debug) { this.$buefy.snackbar.open({ message: this.$t("errors.devBuild"), diff --git a/src/main.js b/src/main.js index a58f694..d9e1a69 100644 --- a/src/main.js +++ b/src/main.js @@ -29,10 +29,6 @@ Vue.use(VMdEditor); Vue.use(VueAxios, axios); Vue.use(Buefy); -// Axios Headers -const jwtToken = localStorage.getItem("token"); -axios.defaults.headers.common["Authorization"] = jwtToken; - Vue.config.productionTip = false; Vue.prototype.$snackbar = Snackbar; diff --git a/src/router/index.js b/src/router/index.js index 2e6b2aa..403e59a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -183,7 +183,7 @@ const routes = [{ redirect: "/settings/general", children: [ { path: 'general', component: route('SettingsGeneral') }, - { path: 'account', component: route('SettingsAccount') }, + { path: 'security', component: route('SettingsSecurity') }, { path: 'about', component: route('SettingsAbout') }, ] }, diff --git a/src/views/Debug.vue b/src/views/Debug.vue index 873ba17..245e243 100644 --- a/src/views/Debug.vue +++ b/src/views/Debug.vue @@ -1,37 +1,72 @@ \ No newline at end of file diff --git a/src/views/Friends.vue b/src/views/Friends.vue index b9f8c53..9452a88 100644 --- a/src/views/Friends.vue +++ b/src/views/Friends.vue @@ -1,54 +1,51 @@ \ No newline at end of file diff --git a/src/views/Home.vue b/src/views/Home.vue index 430a844..a64f057 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -8,13 +8,22 @@
{{ $store.state.user.username }}
- Avatar + Avatar
- {{ $t('home.news') }} + {{ $t("home.news") }}
-
+
{{ blog.name }}
@@ -30,28 +39,52 @@
- {{ $t('home.globalWall') }} + {{ $t("home.globalWall") }}
- + Markdown is no longer available on wall posts. - Post + Post
-
-
+
+
- Avatar + Avatar

- {{ post.fromUser.username }}  + {{ post.fromUser.username }}  {{ post.createdAt | formatDate() }} -
+
{{ post.plainText }}

@@ -67,105 +100,24 @@
-
+
-
- Kaverti -
+
Kaverti
- Kaverti is a new 3D sandbox gaming platform, and avatar social website. -
+ Kaverti is a new 3D sandbox gaming platform, and avatar social + website. +
Kaverti is home to hundreds of users who enjoy using it -
+
So why not sign up today!
-
-
-
-
- Statistics -
-
-
-
{{ $t('stats.users') }}
-
-
- {{ users }} -
- -
-
-
-
{{ $t('stats.users') }}
-
-
- {{ users }} -
- -
-
-
-
{{ $t('stats.posts') }}
-
-
- {{ posts }} -
- -
-
-
-
{{ $t('stats.users') }}
-
-
- {{ users }} -
- -
-
-
-
{{ $t('stats.purchased') }}
-
-
- {{ inventory }} -
- -
-
-
-
{{ $t('stats.items') }}
-
-
- {{ items }} -
- -
-
-
-
{{ $t('stats.teams') }}
-
-
- {{ teams }} -
- -
-
-
-
{{ $t('stats.threads') }}
-
-
- {{ threads }} -
- -
-
-
-
-
-
@@ -174,83 +126,86 @@ import NoItems from "@/components/NoItems"; import AjaxErrorHandler from ".././assets/js/errorHandler"; export default { - name: 'Home', + name: "Home", components: { - NoItems + NoItems, }, data() { return { blogs: [], wallOffset: 0, wallPosts: [], - wallText: '', - mentions: '', + wallText: "", + mentions: "", loadingWallButton: false, loadingWall: true, - users: 0, - posts: 0, - inventory: 0, - teams: 0, - threads: 0, - items: 0, - loading: false - } + }; }, methods: { postWall() { - this.loadingWallButton = true + this.loadingWallButton = true; - this.axios.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `wall/post`, { - username: "GlobalWall", - content: this.wallText - }).then(() => { - this.loadingWallButton = false - this.getWall(true) - }).catch(e => { - this.loadingWallButton = false - AjaxErrorHandler(this.$store)(e) - }) + this.axios + .post( + process.env.VUE_APP_APIENDPOINT + + process.env.VUE_APP_APIVERSION + + `/` + + `wall/post`, + { + username: "GlobalWall", + content: this.wallText, + } + ) + .then(() => { + this.loadingWallButton = false; + this.getWall(true); + }) + .catch((e) => { + this.loadingWallButton = false; + AjaxErrorHandler(this.$store)(e); + }); }, getWall(initial) { - this.loadingWall = true - if(initial) { - this.wallOffset = 0 + this.loadingWall = true; + if (initial) { + this.wallOffset = 0; } this.axios - .get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `user/GlobalWall?wall=true&offset=` + this.wallOffset) - .then(res => { - this.loadingPosts = false - this.loadingWall = false - if(initial) { - this.wallPosts = res.data.userWalls - } else { - this.wallPosts.push(...res.data.userWalls) - } - }) - } + .get( + process.env.VUE_APP_APIENDPOINT + + process.env.VUE_APP_APIVERSION + + `/` + + `user/GlobalWall?wall=true&offset=` + + this.wallOffset + ) + .then((res) => { + this.loadingPosts = false; + this.loadingWall = false; + if (initial) { + this.wallPosts = res.data.userWalls; + } else { + this.wallPosts.push(...res.data.userWalls); + } + }); + }, }, mounted() { - this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/stats') - .then(res => { - this.users = res.data.users - this.posts = res.data.posts - this.inventory = res.data.inventory - this.items = res.data.items - this.teams = res.data.teams - this.threads = res.data.threads - this.loading = false - }).catch(() => { - this.$buefy.snackbar.open({message:this.$t('errors.authFail'), type: 'is-warning'}) - }) - this.axios - .get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `blog/posts`) - .then(res => { - this.blogs = res.data + if (this.$store.state.user.username) { + this.axios + .get( + process.env.VUE_APP_APIENDPOINT + + process.env.VUE_APP_APIVERSION + + `/` + + `blog/posts` + ) + .then((res) => { + this.blogs = res.data; }) - .catch(e => { - AjaxErrorHandler(this.$store)(e) - }) - this.getWall(true) - } -} + .catch((e) => { + AjaxErrorHandler(this.$store)(e); + }); + this.getWall(true); + } + }, +}; \ No newline at end of file diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 9f4bce5..4d442f7 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -46,8 +46,8 @@ export default { route: "general", }, { - name: "Account", - route: "account", + name: "Security", + route: "security", }, { name: "About", diff --git a/src/views/SettingsAbout.vue b/src/views/SettingsAbout.vue index 41cd13c..aab0ef1 100644 --- a/src/views/SettingsAbout.vue +++ b/src/views/SettingsAbout.vue @@ -1,10 +1,10 @@