deleted frontend code

This commit is contained in:
Čarodej
2022-04-27 08:17:06 +02:00
parent f45c1eb576
commit eb4d5b4cba
142 changed files with 338 additions and 15390 deletions
-49
View File
@@ -5,8 +5,6 @@ import router from '../../router'
const defaultState = {
isVisibleNavigationBars: localStorage.getItem('is_navigation_bars') !== 'false',
isVisibleNotificationCenter: false,
notificationCount: 0,
isDarkMode: false,
isVisibleSidebar: localStorage.getItem('file_info_visibility') === 'true' || false,
itemViewType: localStorage.getItem('preview_type') || 'list',
@@ -126,60 +124,13 @@ const mutations = {
REPLACE_CONFIG_VALUE(state, { key, value }) {
state.config[key] = value
},
SET_SOCIAL_LOGIN_CONFIGURED(state, service) {
if (service === 'facebook') {
state.config.allowedFacebookLogin = true
state.config.isFacebookLoginConfigured = true
}
if (service === 'google') {
state.config.allowedGoogleLogin = true
state.config.isGoogleLoginConfigured = true
}
if (service === 'github') {
state.config.allowedGithubLogin = true
state.config.isGithubLoginConfigured = true
}
if (service === 'recaptcha') {
state.config.allowedRecaptcha = true
state.config.isRecaptchaConfigured = true
}
},
SET_STRIPE_CREDENTIALS(state, data) {
state.config.stripe_public_key = data.key
state.config.isStripe = true
},
SET_PAYSTACK_CREDENTIALS(state, data) {
state.config.paystack_public_key = data.key
state.config.isPaystack = true
},
SET_PAYPAL_CREDENTIALS(state, data) {
state.config.paypal_client_id = data.key
state.config.isPayPal = true
if (data.live)
state.config.isPayPalLive = data.live
},
UPDATE_DARK_MODE_STATUS(state, val) {
state.isDarkMode = val
},
UPDATE_NOTIFICATION_COUNT(state, val) {
state.notificationCount = val
},
TOGGLE_NOTIFICATION_CENTER(state) {
state.isVisibleNotificationCenter = !state.isVisibleNotificationCenter
},
CLOSE_NOTIFICATION_CENTER(state) {
state.isVisibleNotificationCenter = false
},
}
const getters = {
isVisibleNotificationCenter: (state) => state.isVisibleNotificationCenter,
isVisibleNavigationBars: (state) => state.isVisibleNavigationBars,
notificationCount: (state) => state.notificationCount,
isVisibleSidebar: (state) => state.isVisibleSidebar,
itemViewType: (state) => state.itemViewType,
api: (state) => state.config.api,
-84
View File
@@ -1,84 +0,0 @@
import { events } from '../../bus'
import i18n from "../../i18n"
const defaultState = {
remoteUploadQueue: undefined,
isBroadcasting: false,
}
const actions = {
runConnection: ({ commit, getters, dispatch }) => {
commit('SET_RUNNING_COMMUNICATION')
Echo.private(`App.Users.Models.User.${getters.user.data.id}`)
.listen('.RemoteFile.Created', (event) => {
commit('UPDATE_REMOTE_UPLOAD_QUEUE', event.payload)
// If user is located in same directory as remote upload was called, then show the files
if (
event.payload.file &&
(!getters.currentFolder && !event.payload.file.data.attributes.parent_id) ||
(getters.currentFolder && event.payload.file.data.attributes.parent_id === getters.currentFolder.data.id)
) {
// Add received item into view
commit('ADD_NEW_ITEMS', event.payload.file)
}
if (event.payload.progress.total === event.payload.progress.processed) {
events.$emit('toaster', {
type: 'success',
message: i18n.t('remote_download_finished'),
})
}
})
.notification((notification) => {
// Play audio
new Audio('/audio/blop.wav').play()
// Call toaster notification
events.$emit('notification', {
data: {
type: notification.category,
id: notification.id,
attributes: {
action: notification.action,
description: notification.description,
title: notification.title,
category: notification.category,
},
},
})
// Reload user data to update notifications
dispatch('getAppData')
})
},
}
const mutations = {
SET_RUNNING_COMMUNICATION(state) {
state.isBroadcasting = true
},
UPDATE_REMOTE_UPLOAD_QUEUE(state, payload) {
if (payload.progress.total !== payload.progress.processed) {
state.remoteUploadQueue = {
total: payload.progress.total,
processed: payload.progress.processed,
}
} else {
state.remoteUploadQueue = undefined
}
},
}
const getters = {
remoteUploadQueue: (state) => state.remoteUploadQueue,
isBroadcasting: (state) => state.isBroadcasting,
}
export default {
state: defaultState,
getters,
actions,
mutations,
}
-1
View File
@@ -104,7 +104,6 @@ const actions = {
return new Promise((resolve, reject) => {
// Get route
let route = {
RequestUpload: `/api/upload-request/${router.currentRoute.params.token}/navigation`,
Public: `/api/browse/navigation/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/browse/navigation'
-5
View File
@@ -59,7 +59,6 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/upload-request/${router.currentRoute.params.token}/move`,
Public: `/api/editor/move/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/move'
@@ -87,7 +86,6 @@ const actions = {
createFolder: ({ commit, getters, dispatch }, folder) => {
// Get route
let route = {
RequestUpload: `/api/upload-request/${router.currentRoute.params.token}/create-folder`,
Public: `/api/editor/create-folder/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/create-folder'
@@ -126,7 +124,6 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/upload-request/${router.currentRoute.params.token}/rename/${data.id}`,
Public: `/api/editor/rename/${data.id}/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || `/api/rename/${data.id}`
@@ -149,7 +146,6 @@ const actions = {
return new Promise((resolve, reject) => {
// Get route
let route = {
RequestUpload: `/api/upload-request/${router.currentRoute.params.token}/upload`,
Public: `/api/editor/upload/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/upload'
@@ -317,7 +313,6 @@ const actions = {
// Get route
let route = {
RequestUpload: `/api/upload-request/${router.currentRoute.params.token}/remove`,
Public: `/api/editor/remove/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/remove'
-617
View File
@@ -89,48 +89,6 @@ const defaultState = {
value: 'sa-east-1',
},
],
transactionColumns: [
{
label: 'note',
field: 'note',
sortable: true,
},
{
label: 'user',
field: 'user_id',
sortable: true,
},
{
label: 'status',
field: 'status',
sortable: true,
},
{
label: 'type',
field: 'type',
sortable: true,
},
{
label: 'total',
field: 'amount',
sortable: true,
},
{
label: 'payed_at',
field: 'created_at',
sortable: true,
},
{
label: 'service',
field: 'driver',
sortable: true,
},
{
label: 'actions',
field: 'actions',
sortable: false,
},
],
roles: [
{
label: 'roles.admin',
@@ -141,24 +99,6 @@ const defaultState = {
value: 'user',
},
],
subscriptionTypes: [
{
label: 'Metered',
value: 'metered',
},
{
label: 'Fixed',
value: 'fixed',
},
{
label: 'None',
value: 'none',
},
],
teamPermissions: {
'can-edit': 'can_edit',
'can-view': 'can_view',
},
countries: [
{ label: 'Czech Republic', value: 'CZ' },
{ label: 'Slovakia', value: 'SK' },
@@ -434,558 +374,6 @@ const defaultState = {
value: 168,
},
],
intervalList: [
{
label: 'monthly',
value: 'month',
},
{
label: 'yearly',
value: 'year',
},
],
currencyList: [
{
label: 'USD - United States Dollar',
value: 'USD',
},
{
label: 'EUR - Euro',
value: 'EUR',
},
{
label: 'GBP - British Pound',
value: 'GBP',
},
{
label: 'AFN - Afghan Afghani',
value: 'AFN',
},
{
label: 'ALL - Albanian Lek',
value: 'ALL',
},
{
label: 'DZD - Algerian Dinar',
value: 'DZD',
},
{
label: 'AOA - Angolan Kwanza',
value: 'AOA',
},
{
label: 'ARS - Argentine Peso',
value: 'ARS',
},
{
label: 'AMD - Armenian Dram',
value: 'AMD',
},
{
label: 'AWG - Aruban Florin',
value: 'AWG',
},
{
label: 'AUD - Australian Dollar',
value: 'AUD',
},
{
label: 'AZN - Azerbaijani Manat',
value: 'AZN',
},
{
label: 'BDT - Bangladeshi Taka',
value: 'BDT',
},
{
label: 'BBD - Barbadian Dollar',
value: 'BBD',
},
{
label: 'BZD - Belize Dollar',
value: 'BZD',
},
{
label: 'BMD - Bermudian Dollar',
value: 'BMD',
},
{
label: 'BOB - Bolivian Boliviano',
value: 'BOB',
},
{
label: 'BAM - Bosnia & Herzegovina Convertible Mark',
value: 'BAM',
},
{
label: 'BWP - Botswana Pula',
value: 'BWP',
},
{
label: 'BRL - Brazilian Real',
value: 'BRL',
},
{
label: 'BND - Brunei Dollar',
value: 'BND',
},
{
label: 'BGN - Bulgarian Lev',
value: 'BGN',
},
{
label: 'BIF - Burundian Franc',
value: 'BIF',
},
{
label: 'KHR - Cambodian Riel',
value: 'KHR',
},
{
label: 'CAD - Canadian Dollar',
value: 'CAD',
},
{
label: 'CVE - Cape Verdean Escudo',
value: 'CVE',
},
{
label: 'KYD - Cayman Islands Dollar',
value: 'KYD',
},
{
label: 'XAF - Central African Cfa Franc',
value: 'XAF',
},
{
label: 'XPF - Cfp Franc',
value: 'XPF',
},
{
label: 'CLP - Chilean Peso',
value: 'CLP',
},
{
label: 'CNY - Chinese Renminbi Yuan',
value: 'CNY',
},
{
label: 'COP - Colombian Peso',
value: 'COP',
},
{
label: 'KMF - Comorian Franc',
value: 'KMF',
},
{
label: 'CDF - Congolese Franc',
value: 'CDF',
},
{
label: 'CRC - Costa Rican Colón',
value: 'CRC',
},
{
label: 'HRK - Croatian Kuna',
value: 'HRK',
},
{
label: 'CZK - Czech Koruna',
value: 'CZK',
},
{
label: 'DKK - Danish Krone',
value: 'DKK',
},
{
label: 'DJF - Djiboutian Franc',
value: 'DJF',
},
{
label: 'DOP - Dominican Peso',
value: 'DOP',
},
{
label: 'XCD - East Caribbean Dollar',
value: 'XCD',
},
{
label: 'EGP - Egyptian Pound',
value: 'EGP',
},
{
label: 'ETB - Ethiopian Birr',
value: 'ETB',
},
{
label: 'FKP - Falkland Islands Pound',
value: 'FKP',
},
{
label: 'FJD - Fijian Dollar',
value: 'FJD',
},
{
label: 'GMD - Gambian Dalasi',
value: 'GMD',
},
{
label: 'GEL - Georgian Lari',
value: 'GEL',
},
{
label: 'GIP - Gibraltar Pound',
value: 'GIP',
},
{
label: 'GTQ - Guatemalan Quetzal',
value: 'GTQ',
},
{
label: 'GNF - Guinean Franc',
value: 'GNF',
},
{
label: 'GYD - Guyanese Dollar',
value: 'GYD',
},
{
label: 'HTG - Haitian Gourde',
value: 'HTG',
},
{
label: 'HNL - Honduran Lempira',
value: 'HNL',
},
{
label: 'HKD - Hong Kong Dollar',
value: 'HKD',
},
{
label: 'HUF - Hungarian Forint',
value: 'HUF',
},
{
label: 'ISK - Icelandic Króna',
value: 'ISK',
},
{
label: 'INR - Indian Rupee',
value: 'INR',
},
{
label: 'IDR - Indonesian Rupiah',
value: 'IDR',
},
{
label: 'ILS - Israeli New Sheqel',
value: 'ILS',
},
{
label: 'JMD - Jamaican Dollar',
value: 'JMD',
},
{
label: 'JPY - Japanese Yen',
value: 'JPY',
},
{
label: 'KZT - Kazakhstani Tenge',
value: 'KZT',
},
{
label: 'KES - Kenyan Shilling',
value: 'KES',
},
{
label: 'KGS - Kyrgyzstani Som',
value: 'KGS',
},
{
label: 'LAK - Lao Kip',
value: 'LAK',
},
{
label: 'LBP - Lebanese Pound',
value: 'LBP',
},
{
label: 'LSL - Lesotho Loti',
value: 'LSL',
},
{
label: 'LRD - Liberian Dollar',
value: 'LRD',
},
{
label: 'MOP - Macanese Pataca',
value: 'MOP',
},
{
label: 'MKD - Macedonian Denar',
value: 'MKD',
},
{
label: 'MGA - Malagasy Ariary',
value: 'MGA',
},
{
label: 'MWK - Malawian Kwacha',
value: 'MWK',
},
{
label: 'MYR - Malaysian Ringgit',
value: 'MYR',
},
{
label: 'MVR - Maldivian Rufiyaa',
value: 'MVR',
},
{
label: 'MRO - Mauritanian Ouguiya',
value: 'MRO',
},
{
label: 'MUR - Mauritian Rupee',
value: 'MUR',
},
{
label: 'MXN - Mexican Peso',
value: 'MXN',
},
{
label: 'MDL - Moldovan Leu',
value: 'MDL',
},
{
label: 'MNT - Mongolian Tögrög',
value: 'MNT',
},
{
label: 'MAD - Moroccan Dirham',
value: 'MAD',
},
{
label: 'MZN - Mozambican Metical',
value: 'MZN',
},
{
label: 'MMK - Myanmar Kyat',
value: 'MMK',
},
{
label: 'NAD - Namibian Dollar',
value: 'NAD',
},
{
label: 'NPR - Nepalese Rupee',
value: 'NPR',
},
{
label: 'ANG - Netherlands Antillean Gulden',
value: 'ANG',
},
{
label: 'TWD - New Taiwan Dollar',
value: 'TWD',
},
{
label: 'NZD - New Zealand Dollar',
value: 'NZD',
},
{
label: 'NIO - Nicaraguan Córdoba',
value: 'NIO',
},
{
label: 'NGN - Nigerian Naira',
value: 'NGN',
},
{
label: 'NOK - Norwegian Krone',
value: 'NOK',
},
{
label: 'PKR - Pakistani Rupee',
value: 'PKR',
},
{
label: 'PAB - Panamanian Balboa',
value: 'PAB',
},
{
label: 'PGK - Papua New Guinean Kina',
value: 'PGK',
},
{
label: 'PYG - Paraguayan Guaraní',
value: 'PYG',
},
{
label: 'PEN - Peruvian Nuevo Sol',
value: 'PEN',
},
{
label: 'PHP - Philippine Peso',
value: 'PHP',
},
{
label: 'PLN - Polish Złoty',
value: 'PLN',
},
{
label: 'QAR - Qatari Riyal',
value: 'QAR',
},
{
label: 'RON - Romanian Leu',
value: 'RON',
},
{
label: 'RUB - Russian Ruble',
value: 'RUB',
},
{
label: 'RWF - Rwandan Franc',
value: 'RWF',
},
{
label: 'STD - São Tomé and Príncipe Dobra',
value: 'STD',
},
{
label: 'SHP - Saint Helenian Pound',
value: 'SHP',
},
{
label: 'SVC - Salvadoran Colón',
value: 'SVC',
},
{
label: 'WST - Samoan Tala',
value: 'WST',
},
{
label: 'SAR - Saudi Riyal',
value: 'SAR',
},
{
label: 'RSD - Serbian Dinar',
value: 'RSD',
},
{
label: 'SCR - Seychellois Rupee',
value: 'SCR',
},
{
label: 'SLL - Sierra Leonean Leone',
value: 'SLL',
},
{
label: 'SGD - Singapore Dollar',
value: 'SGD',
},
{
label: 'SBD - Solomon Islands Dollar',
value: 'SBD',
},
{
label: 'SOS - Somali Shilling',
value: 'SOS',
},
{
label: 'ZAR - South African Rand',
value: 'ZAR',
},
{
label: 'KRW - South Korean Won',
value: 'KRW',
},
{
label: 'LKR - Sri Lankan Rupee',
value: 'LKR',
},
{
label: 'SRD - Surinamese Dollar',
value: 'SRD',
},
{
label: 'SZL - Swazi Lilangeni',
value: 'SZL',
},
{
label: 'SEK - Swedish Krona',
value: 'SEK',
},
{
label: 'CHF - Swiss Franc',
value: 'CHF',
},
{
label: 'TJS - Tajikistani Somoni',
value: 'TJS',
},
{
label: 'TZS - Tanzanian Shilling',
value: 'TZS',
},
{
label: 'THB - Thai Baht',
value: 'THB',
},
{
label: 'TOP - Tongan Paʻanga',
value: 'TOP',
},
{
label: 'TTD - Trinidad and Tobago Dollar',
value: 'TTD',
},
{
label: 'TRY - Turkish Lira',
value: 'TRY',
},
{
label: 'UGX - Ugandan Shilling',
value: 'UGX',
},
{
label: 'UAH - Ukrainian Hryvnia',
value: 'UAH',
},
{
label: 'AED - United Arab Emirates Dirham',
value: 'AED',
},
{
label: 'UYU - Uruguayan Peso',
value: 'UYU',
},
{
label: 'UZS - Uzbekistani Som',
value: 'UZS',
},
{
label: 'VUV - Vanuatu Vatu',
value: 'VUV',
},
{
label: 'VND - Vietnamese Đồng',
value: 'VND',
},
{
label: 'XOF - West African Cfa Franc',
value: 'XOF',
},
{
label: 'YER - Yemeni Rial',
value: 'YER',
},
{
label: 'ZMW - Zambian Kwacha',
value: 'ZMW',
},
],
timezones: [
{
value: '-12.0',
@@ -1115,12 +503,7 @@ const defaultState = {
}
const getters = {
transactionColumns: (state) => state.transactionColumns,
subscriptionTypes: (state) => state.subscriptionTypes,
teamPermissions: (state) => state.teamPermissions,
expirationList: (state) => state.expirationList,
currencyList: (state) => state.currencyList,
intervalList: (state) => state.intervalList,
timezones: (state) => state.timezones,
countries: (state) => state.countries,
s3Regions: (state) => state.s3Regions,
-32
View File
@@ -1,32 +0,0 @@
import { events } from '../../bus'
const defaultState = {
singleChargeAmount: undefined,
}
const actions = {
callSingleChargeProcess: ({ commit }, amount) => {
// Open popup with payment methods
events.$emit('popup:open', { name: 'select-payment-method' })
// Store charge amount
commit('SET_SINGLE_CHARGE_AMOUNT', amount)
},
}
const mutations = {
SET_SINGLE_CHARGE_AMOUNT(state, amount) {
state.singleChargeAmount = amount
},
}
const getters = {
singleChargeAmount: (state) => state.singleChargeAmount,
}
export default {
state: defaultState,
getters,
actions,
mutations,
}
-129
View File
@@ -1,129 +0,0 @@
import router from '../../router'
import { events } from '../../bus'
import i18n from '../../i18n'
import axios from 'axios'
import Vue from 'vue'
const defaultState = {
currentTeamFolder: undefined,
}
const actions = {
getTeamFolder: ({ commit, getters }, id) => {
commit('LOADING_STATE', { loading: true, data: [] })
if (typeof id === 'undefined') {
commit('SET_CURRENT_TEAM_FOLDER', null)
}
axios
.get(`${getters.api}/teams/folders/${id}${getters.sorting.URI}`)
.then((response) => {
let folders = response.data.folders.data
let files = response.data.files.data
commit('LOADING_STATE', {
loading: false,
data: folders.concat(files),
})
commit('SET_CURRENT_FOLDER', response.data.root)
if (
!getters.currentTeamFolder ||
getters.currentTeamFolder.data.id !== response.data.teamFolder.data.id
) {
commit('SET_CURRENT_TEAM_FOLDER', response.data.teamFolder)
}
events.$emit('scrollTop')
})
.catch((error) => {
// Redirect if unauthenticated
if ([401, 403].includes(error.response.status)) {
commit('SET_AUTHORIZED', false)
router.push({ name: 'SignIn' })
} else {
// Show error message
events.$emit('alert:open', {
title: i18n.t('popup_error.title'),
message: i18n.t('popup_error.message'),
})
}
})
},
getSharedWithMeFolder: ({ commit, getters }, id) => {
commit('LOADING_STATE', { loading: true, data: [] })
if (typeof id === 'undefined') {
commit('SET_CURRENT_TEAM_FOLDER', null)
}
axios
.get(`${getters.api}/teams/shared-with-me/${id}${getters.sorting.URI}`)
.then((response) => {
let folders = response.data.folders.data
let files = response.data.files.data
commit('LOADING_STATE', {
loading: false,
data: folders.concat(files),
})
commit('SET_CURRENT_FOLDER', response.data.root)
if (
!getters.currentTeamFolder ||
getters.currentTeamFolder.data.id !== response.data.teamFolder.data.id
) {
commit('SET_CURRENT_TEAM_FOLDER', response.data.teamFolder)
}
events.$emit('scrollTop')
})
.catch((error) => {
// Redirect if unauthenticated
if ([401, 403].includes(error.response.status)) {
commit('SET_AUTHORIZED', false)
router.push({ name: 'SignIn' })
} else {
// Show error message
events.$emit('alert:open', {
title: i18n.t('popup_error.title'),
message: i18n.t('popup_error.message'),
})
}
})
},
getTeamFolderTree: ({ commit, getters }) => {
return new Promise((resolve, reject) => {
axios
.get(`/api/teams/folders/${getters.currentTeamFolder.data.id}/tree${getters.sorting.URI}`)
.then((response) => {
resolve(response)
commit('UPDATE_FOLDER_TREE', response.data)
})
.catch((error) => {
reject(error)
Vue.prototype.$isSomethingWrong()
})
})
},
}
const mutations = {
SET_CURRENT_TEAM_FOLDER(state, payload) {
state.currentTeamFolder = payload
},
}
const getters = {
currentTeamFolder: (state) => state.currentTeamFolder,
}
export default {
state: defaultState,
getters,
actions,
mutations,
}
-83
View File
@@ -1,83 +0,0 @@
import router from '../../router'
import { events } from '../../bus'
import axios from 'axios'
import Vue from 'vue'
const defaultState = {
uploadRequest: undefined,
}
const actions = {
getUploadRequestFolder: ({ commit, getters }, id) => {
commit('LOADING_STATE', { loading: true, data: [] })
return new Promise((resolve, reject) => {
axios
.get(`/api/upload-request/${router.currentRoute.params.token}/browse/${id}${getters.sorting.URI}`)
.then((response) => {
let folders = response.data.folders.data
let files = response.data.files.data
commit('LOADING_STATE', {
loading: false,
data: folders.concat(files),
})
commit('SET_CURRENT_FOLDER', response.data.root)
events.$emit('scrollTop')
resolve(response)
})
.catch((error) => {
Vue.prototype.$isSomethingWrong()
reject(error)
})
})
},
getUploadRequestDetail: ({ commit }) => {
return new Promise((resolve, reject) => {
axios.get(`/api/upload-request/${router.currentRoute.params.token}`)
.then((response) => {
resolve(response)
// Stop loading spinner
if (['active', 'filled', 'expired'].includes(response.data.data.attributes.status) )
commit('LOADING_STATE', { loading: false, data: [] })
commit('SET_UPLOAD_REQUEST', response.data)
// Set current folder if exist
if (! router.currentRoute.params.id) {
commit('SET_CURRENT_FOLDER', response.data.data.relationships.folder)
}
})
})
},
closeUploadRequest: ({ commit }) => {
axios
.delete(`/api/upload-request/${router.currentRoute.params.token}`)
.then((response) => {
commit('LOADING_STATE', { loading: false, data: [] })
commit('SET_UPLOAD_REQUEST', response.data)
})
.catch(() => this.$isSomethingWrong())
},
}
const mutations = {
SET_UPLOAD_REQUEST(state, payload) {
state.uploadRequest = payload
},
}
const getters = {
uploadRequest: (state) => state.uploadRequest,
}
export default {
state: defaultState,
getters,
actions,
mutations,
}
-53
View File
@@ -16,11 +16,6 @@ const actions = {
resolve(response)
commit('RETRIEVE_USER', response.data)
commit('UPDATE_NOTIFICATION_COUNT', response.data.data.relationships.unreadNotifications.data.length)
if (! getters.isBroadcasting && getters.config.broadcasting === 'pusher') {
dispatch('runConnection')
}
})
.catch((error) => {
reject(error)
@@ -53,16 +48,6 @@ const actions = {
router.push({name: 'Homepage'})
})
},
socialiteRedirect: ({ commit }, provider) => {
axios
.get(`/api/socialite/${provider}/redirect`)
.then((response) => {
if (response.data.url) {
window.location.href = response.data.url
}
})
.catch(() => this.$isSomethingWrong())
},
addToFavourites: (context, folder) => {
let addFavourites = []
let items = [folder]
@@ -116,19 +101,6 @@ const actions = {
})
.catch(() => Vue.prototype.$isSomethingWrong())
},
readAllNotifications: ({ commit }) => {
axios.post('/api/user/notifications/read')
.then(() => {
commit('UPDATE_NOTIFICATION_COUNT', 0)
})
},
deleteAllNotifications: ({ commit }) => {
axios.delete('/api/user/notifications')
.then(() => {
commit('FLUSH_NOTIFICATIONS')
})
.catch(() => Vue.prototype.$isSomethingWrong())
},
}
const mutations = {
@@ -178,34 +150,9 @@ const mutations = {
}
})
},
FLUSH_NOTIFICATIONS(state) {
state.user.data.relationships.readNotifications.data = []
state.user.data.relationships.unreadNotifications.data = []
},
CLEAR_NOTIFICATION_ACTION_DATA(state, notificationId) {
if (state.user.data.relationships.readNotifications.data.length) {
state.user.data.relationships.readNotifications.data.map(notification => {
if (notification.data.id === notificationId) {
notification.data.attributes.action = undefined
}
})
}
if (state.user.data.relationships.unreadNotifications.data.length) {
state.user.data.relationships.unreadNotifications.data.map(notification => {
if (notification.data.id === notificationId) {
notification.data.attributes.action = undefined
}
})
}
},
}
const getters = {
isLimitedUser: (state) =>
state.user &&
state.user.data.relationships.failedPayments &&
state.user.data.relationships.failedPayments.data.length === 3,
permission: (state) => state.permission,
user: (state) => state.user,
}