aboutsummaryrefslogtreecommitdiff
path: root/src/site/pages/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/site/pages/dashboard')
-rw-r--r--src/site/pages/dashboard/account.vue19
-rw-r--r--src/site/pages/dashboard/albums/_id.vue13
-rw-r--r--src/site/pages/dashboard/albums/index.vue29
-rw-r--r--src/site/pages/dashboard/index.vue13
-rw-r--r--src/site/pages/dashboard/settings.vue9
-rw-r--r--src/site/pages/dashboard/tags/index.vue15
-rw-r--r--src/site/pages/dashboard/users.vue17
7 files changed, 62 insertions, 53 deletions
diff --git a/src/site/pages/dashboard/account.vue b/src/site/pages/dashboard/account.vue
index 3ff6c70..df07591 100644
--- a/src/site/pages/dashboard/account.vue
+++ b/src/site/pages/dashboard/account.vue
@@ -67,7 +67,8 @@
message="This API key lets you use the service from other apps"
horizontal>
<b-input v-model="user.apiKey"
- expanded />
+ expanded
+ disabled />
</b-field>
<div class="mb2 mt2 text-center">
@@ -88,6 +89,7 @@ export default {
components: {
Sidebar
},
+ middleware: 'auth',
data() {
return {
user: {}
@@ -107,8 +109,8 @@ export default {
methods: {
async getUserSetttings() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/users/me`);
- this.user = response.data.user;
+ const response = await this.$axios.$get(`users/me`);
+ this.user = response.user;
} catch (error) {
this.$onPromiseError(error);
}
@@ -118,12 +120,12 @@ export default {
if (this.user.newPassword !== this.user.reNewPassword) return this.$showToast('Passwords don\'t match', true);
try {
- const response = await this.axios.post(`${this.config.baseURL}/user/password/change`,
+ const response = await this.$axios.$post(`user/password/change`,
{
password: this.user.password,
newPassword: this.user.newPassword
});
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
} catch (error) {
this.$onPromiseError(error);
}
@@ -136,9 +138,10 @@ export default {
},
async requestNewAPIKey() {
try {
- const response = await this.axios.post(`${this.config.baseURL}/user/apikey/change`);
- this.user.apiKey = response.data.apiKey;
- this.$toast.open(response.data.message);
+ const response = await this.$axios.$post(`user/apikey/change`);
+ this.user.apiKey = response.apiKey;
+ this.$forceUpdate();
+ this.$toast.open(response.message);
} catch (error) {
this.$onPromiseError(error);
}
diff --git a/src/site/pages/dashboard/albums/_id.vue b/src/site/pages/dashboard/albums/_id.vue
index f5ec683..ed5f8fd 100644
--- a/src/site/pages/dashboard/albums/_id.vue
+++ b/src/site/pages/dashboard/albums/_id.vue
@@ -61,6 +61,7 @@ export default {
Sidebar,
Grid
},
+ middleware: 'auth',
data() {
return {
name: null,
@@ -94,11 +95,11 @@ export default {
},
async albumCheckboxClicked(value, id) {
try {
- const response = await this.axios.post(`${this.config.baseURL}/file/album/${value ? 'add' : 'del'}`, {
+ const response = await this.$axios.$post(`file/album/${value ? 'add' : 'del'}`, {
albumId: id,
fileId: this.showingModalForFile.id
});
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
this.getFiles();
} catch (error) {
this.$onPromiseError(error);
@@ -107,16 +108,16 @@ export default {
async getFiles() {
// TODO: Make this think SSR with AsyncData
try {
- const response = await this.axios.get(`${this.config.baseURL}/album/${this.$route.params.id}/full`);
- this.files = response.data.files;
+ const response = await this.$axios.$get(`album/${this.$route.params.id}/full`);
+ this.files = response.files;
} catch (error) {
console.error(error);
}
},
async getAlbums() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/albums/dropdown`);
- this.albums = response.data.albums;
+ const response = await this.$axios.$get(`albums/dropdown`);
+ this.albums = response.albums;
} catch (error) {
this.$onPromiseError(error);
}
diff --git a/src/site/pages/dashboard/albums/index.vue b/src/site/pages/dashboard/albums/index.vue
index 1ad7653..c2c054d 100644
--- a/src/site/pages/dashboard/albums/index.vue
+++ b/src/site/pages/dashboard/albums/index.vue
@@ -275,6 +275,7 @@ export default {
components: {
Sidebar
},
+ middleware: 'auth',
data() {
return {
albums: [],
@@ -310,9 +311,9 @@ export default {
},
async deleteAlbum(id, purge) {
try {
- const response = await this.axios.delete(`${this.config.baseURL}/album/${id}/${purge ? true : ''}`);
+ const response = await this.$axios.$delete(`album/${id}/${purge ? true : ''}`);
this.getAlbums();
- return this.$toast.open(response.data.message);
+ return this.$toast.open(response.message);
} catch (error) {
return this.$onPromiseError(error);
}
@@ -326,21 +327,21 @@ export default {
async deleteAlbumLink(identifier) {
console.log('> deleteAlbumLink', identifier);
try {
- const response = await this.axios.delete(`${this.config.baseURL}/album/link/delete/${identifier}`);
- return this.$toast.open(response.data.message);
+ const response = await this.$axios.$delete(`album/link/delete/${identifier}`);
+ return this.$toast.open(response.message);
} catch (error) {
return this.$onPromiseError(error);
}
},
async linkOptionsChanged(link) {
try {
- const response = await this.axios.post(`${this.config.baseURL}/album/link/edit`,
+ const response = await this.$axios.$post(`album/link/edit`,
{
identifier: link.identifier,
enableDownload: link.enableDownload,
enabled: link.enabled
});
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
} catch (error) {
this.$onPromiseError(error);
}
@@ -348,11 +349,11 @@ export default {
async createLink(album) {
album.isCreatingLink = true;
try {
- const response = await this.axios.post(`${this.config.baseURL}/album/link/new`,
+ const response = await this.$axios.$post(`album/link/new`,
{ albumId: album.id });
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
album.links.push({
- identifier: response.data.identifier,
+ identifier: response.identifier,
views: 0,
enabled: true,
enableDownload: true,
@@ -367,10 +368,10 @@ export default {
async createAlbum() {
if (!this.newAlbumName || this.newAlbumName === '') return;
try {
- const response = await this.axios.post(`${this.config.baseURL}/album/new`,
+ const response = await this.$axios.$post(`album/new`,
{ name: this.newAlbumName });
this.newAlbumName = null;
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
this.getAlbums();
} catch (error) {
this.$onPromiseError(error);
@@ -378,11 +379,11 @@ export default {
},
async getAlbums() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/albums/mini`);
- for (const album of response.data.albums) {
+ const response = await this.$axios.$get(`albums/mini`);
+ for (const album of response.albums) {
album.isDetailsOpen = false;
}
- this.albums = response.data.albums;
+ this.albums = response.albums;
} catch (error) {
this.$onPromiseError(error);
}
diff --git a/src/site/pages/dashboard/index.vue b/src/site/pages/dashboard/index.vue
index 92da2a7..6d547e2 100644
--- a/src/site/pages/dashboard/index.vue
+++ b/src/site/pages/dashboard/index.vue
@@ -61,6 +61,7 @@ export default {
Sidebar,
Grid
},
+ middleware: 'auth',
data() {
return {
files: [],
@@ -93,11 +94,11 @@ export default {
},
async albumCheckboxClicked(value, id) {
try {
- const response = await this.axios.post(`${this.config.baseURL}/file/album/${value ? 'add' : 'del'}`, {
+ const response = await this.$axios.$post(`file/album/${value ? 'add' : 'del'}`, {
albumId: id,
fileId: this.showingModalForFile.id
});
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
// Not the prettiest solution to refetch on each click but it'll do for now
this.getFiles();
@@ -107,16 +108,16 @@ export default {
},
async getFiles() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/files`);
- this.files = response.data.files;
+ const response = await this.$axios.$get(`files`);
+ this.files = response.files;
} catch (error) {
console.error(error);
}
},
async getAlbums() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/albums/dropdown`);
- this.albums = response.data.albums;
+ const response = await this.$axios.$get(`albums/dropdown`);
+ this.albums = response.albums;
} catch (error) {
this.$onPromiseError(error);
}
diff --git a/src/site/pages/dashboard/settings.vue b/src/site/pages/dashboard/settings.vue
index 02bf5d2..23635ed 100644
--- a/src/site/pages/dashboard/settings.vue
+++ b/src/site/pages/dashboard/settings.vue
@@ -132,6 +132,7 @@ export default {
components: {
Sidebar
},
+ middleware: 'auth',
data() {
return {
options: {}
@@ -151,8 +152,8 @@ export default {
methods: {
async getSettings() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/service/config`);
- this.options = response.data.config;
+ const response = await this.$axios.$get(`service/config`);
+ this.options = response.config;
console.log(this.options);
} catch (error) {
this.$onPromiseError(error);
@@ -166,8 +167,8 @@ export default {
},
async restartService() {
try {
- const response = await this.axios.post(`${this.config.baseURL}/service/restart`);
- this.$toast.open(response.data.message);
+ const response = await this.$axios.$post(`service/restart`);
+ this.$toast.open(response.message);
return;
} catch (error) {
this.$onPromiseError(error);
diff --git a/src/site/pages/dashboard/tags/index.vue b/src/site/pages/dashboard/tags/index.vue
index b4c5906..cc057a1 100644
--- a/src/site/pages/dashboard/tags/index.vue
+++ b/src/site/pages/dashboard/tags/index.vue
@@ -214,6 +214,7 @@ export default {
components: {
Sidebar
},
+ middleware: 'auth',
data() {
return {
tags: [],
@@ -249,9 +250,9 @@ export default {
},
async deleteTag(id, purge) {
try {
- const response = await this.axios.delete(`${this.config.baseURL}/tags/${id}/${purge ? true : ''}`);
+ const response = await this.$axios.$delete(`tags/${id}/${purge ? true : ''}`);
this.getTags();
- return this.$toast.open(response.data.message);
+ return this.$toast.open(response.message);
} catch (error) {
return this.$onPromiseError(error);
}
@@ -259,10 +260,10 @@ export default {
async createTag() {
if (!this.newTagName || this.newTagName === '') return;
try {
- const response = await this.axios.post(`${this.config.baseURL}/tag/new`,
+ const response = await this.$axios.$post(`tag/new`,
{ name: this.newTagName });
this.newTagName = null;
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
this.getTags();
} catch (error) {
this.$onPromiseError(error);
@@ -270,11 +271,11 @@ export default {
},
async getTags() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/tags`);
- for (const tag of response.data.tags) {
+ const response = await this.$axios.$get(`tags`);
+ for (const tag of response.tags) {
tag.isDetailsOpen = false;
}
- this.tags = response.data.tags;
+ this.tags = response.tags;
} catch (error) {
this.$onPromiseError(error);
}
diff --git a/src/site/pages/dashboard/users.vue b/src/site/pages/dashboard/users.vue
index 820969a..4ef3e5b 100644
--- a/src/site/pages/dashboard/users.vue
+++ b/src/site/pages/dashboard/users.vue
@@ -207,6 +207,7 @@ export default {
components: {
Sidebar
},
+ middleware: ['auth', 'admin'],
data() {
return {
users: []
@@ -226,8 +227,8 @@ export default {
methods: {
async getUsers() {
try {
- const response = await this.axios.get(`${this.config.baseURL}/admin/users`);
- this.users = response.data.users;
+ const response = await this.$axios.$get(`admin/users`);
+ this.users = response.users;
console.log(this.users);
} catch (error) {
this.$onPromiseError(error);
@@ -235,20 +236,20 @@ export default {
},
async changeEnabledStatus(row) {
try {
- const response = await this.axios.post(`${this.config.baseURL}/admin/users/${row.enabled ? 'enable' : 'disable'}`, {
+ const response = await this.$axios.$post(`admin/users/${row.enabled ? 'enable' : 'disable'}`, {
id: row.id
});
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
} catch (error) {
this.$onPromiseError(error);
}
},
async changeIsAdmin(row) {
try {
- const response = await this.axios.post(`${this.config.baseURL}/admin/users/${row.isAdmin ? 'promote' : 'demote'}`, {
+ const response = await this.$axios.$post(`admin/users/${row.isAdmin ? 'promote' : 'demote'}`, {
id: row.id
});
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
} catch (error) {
this.$onPromiseError(error);
}
@@ -261,10 +262,10 @@ export default {
},
async purgeFiles(row) {
try {
- const response = await this.axios.post(`${this.config.baseURL}/admin/users/purge`, {
+ const response = await this.$axios.$post(`admin/users/purge`, {
id: row.id
});
- this.$toast.open(response.data.message);
+ this.$toast.open(response.message);
} catch (error) {
this.$onPromiseError(error);
}