Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
Fix linter and errors
Acho Arnolde53d09744283
diff --git a/web/nuxt.config.js b/web/nuxt.config.jsindex d3a9b1e4..f1cc1ef8 100644--- a/web/nuxt.config.js+++ b/web/nuxt.config.js@@ -78,8 +78,6 @@ export default {// Modules: https://go.nuxtjs.dev/config-modulesmodules: [- // https://go.nuxtjs.dev/axios- '@nuxtjs/axios',// Simple usage'@nuxtjs/dotenv',[@@ -118,12 +116,6 @@ export default {'@nuxtjs/sitemap', // always put it at the end],- // Axios module configuration: https://go.nuxtjs.dev/config-axios- axios: {- // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308- baseURL: process.env.BASE_URL || 'http://localhost:8000',- },-// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetifyvuetify: {treeShake: true,diff --git a/web/package.json b/web/package.jsonindex 41ce5d23..ccb03999 100644--- a/web/package.json+++ b/web/package.json@@ -22,7 +22,6 @@},"dependencies": {"@mdi/js": "^7.2.96",- "@nuxtjs/axios": "^5.13.6","@nuxtjs/dotenv": "^1.4.1","@nuxtjs/firebase": "^8.2.2","@nuxtjs/sitemap": "^2.4.0",diff --git a/web/plugins/errors.ts b/web/plugins/errors.tsindex 4f91bbb5..d956f785 100644--- a/web/plugins/errors.ts+++ b/web/plugins/errors.ts@@ -1,12 +1,7 @@-// @ts-ignoreimport { AxiosError } from 'axios'import Bag from '@/plugins/bag'import capitalize from '@/plugins/capitalize'-export type ErrorMessagesSerialized = {- [name: string]: Array<string>-}-export class ErrorMessages extends Bag<string> {}const sanitize = (key: string, values: Array<string>): Array<string> => {@@ -31,15 +26,15 @@ export const getErrorMessages = (error: AxiosError): ErrorMessages => {const errors = new ErrorMessages()if (error === null ||- typeof error.response?.data?.data !== 'object' ||- error.response?.data?.data === null ||+ typeof (error.response?.data as any)?.data !== 'object' ||+ (error.response?.data as any)?.data === null ||error.response?.status !== 422) {return errors}- Object.keys(error.response.data.data).forEach((key: string) => {- errors.addMany(key, sanitize(key, error.response?.data.data[key]))+ Object.keys((error.response?.data as any).data).forEach((key: string) => {+ errors.addMany(key, sanitize(key, (error.response?.data as any).data[key]))})return errorsdiff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yamlindex 4a8ec892..c57b79fc 100644--- a/web/pnpm-lock.yaml+++ b/web/pnpm-lock.yaml@@ -8,9 +8,6 @@ dependencies:'@mdi/js':specifier: ^7.2.96version: 7.2.96- '@nuxtjs/axios':- specifier: ^5.13.6- version: 5.13.6'@nuxtjs/dotenv':specifier: ^1.4.1version: 1.4.1@@ -4734,21 +4731,6 @@ packages:- whiskersdev: false- /@nuxtjs/[email protected]:- resolution:- {- integrity: sha512-XS+pOE0xsDODs1zAIbo95A0LKlilvJi8YW0NoXYuq3/jjxGgWDxizZ6Yx0AIIjZOoGsXJOPc0/BcnSEUQ2mFBA==,- }- dependencies:- '@nuxtjs/proxy': 2.1.0- axios: 0.21.4- axios-retry: 3.8.0- consola: 2.15.3- defu: 5.0.1- transitivePeerDependencies:- - debug- dev: false-/@nuxtjs/[email protected]:resolution:{@@ -4846,17 +4828,6 @@ packages:- supports-colordev: false- /@nuxtjs/[email protected]:- resolution:- {- integrity: sha512-/qtoeqXgZ4Mg6LRg/gDUZQrFpOlOdHrol/vQYMnKu3aN3bP90UfOUB3QSDghUUK7OISAJ0xp8Ld78aHyCTcKCQ==,- }- dependencies:- http-proxy-middleware: 1.3.1- transitivePeerDependencies:- - debug- dev: false-/@nuxtjs/[email protected]:resolution:{@@ -5315,15 +5286,6 @@ packages:'@types/uglify-js': 3.17.2dev: true- /@types/[email protected]:- resolution:- {- integrity: sha512-kQtujO08dVtQ2wXAuSFfk9ASy3sug4+ogFR8Kd8UgP8PEuc1/G/8yjYRmp//PcDNJEUKOza/MrQu15bouEUCiw==,- }- dependencies:- '@types/node': 20.8.0- dev: false-/@types/[email protected]:resolution:{@@ -7012,27 +6974,6 @@ packages:}engines: { node: '>= 0.4' }- resolution:- {- integrity: sha512-CfIsQyWNc5/AE7x/UEReRUadiBmQeoBpSEC+4QyGLJMswTsP1tz0GW2YYPnE7w9+ESMef5zOgLDFpHynNyEZ1w==,- }- dependencies:- '@babel/runtime': 7.23.1- is-retry-allowed: 2.2.0- dev: false-- resolution:- {- integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==,- }- dependencies:- follow-redirects: 1.15.3- transitivePeerDependencies:- - debug- dev: false-resolution:{@@ -10725,13 +10666,6 @@ packages:dev: falseoptional: true- resolution:- {- integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==,- }- dev: false-resolution:{@@ -12414,36 +12348,6 @@ packages:dev: falseoptional: true- resolution:- {- integrity: sha512-13eVVDYS4z79w7f1+NPllJtOQFx/FdUW4btIvVRMaRlUY9VGstAbo5MOhLEuUgZFRHn3x50ufn25zkj/boZnEg==,- }- engines: { node: '>=8.0.0' }- dependencies:- '@types/http-proxy': 1.17.12- http-proxy: 1.18.1- is-glob: 4.0.3- is-plain-obj: 3.0.0- micromatch: 4.0.5- transitivePeerDependencies:- - debug- dev: false-- resolution:- {- integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==,- }- engines: { node: '>=8.0.0' }- dependencies:- eventemitter3: 4.0.7- follow-redirects: 1.15.3- requires-port: 1.0.0- transitivePeerDependencies:- - debug- dev: false-resolution:{@@ -12959,14 +12863,6 @@ packages:}engines: { node: '>=0.10.0' }- resolution:- {- integrity: sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==,- }- engines: { node: '>=10' }- dev: false-resolution:{@@ -13001,14 +12897,6 @@ packages:call-bind: 1.0.2has-tostringtag: 1.0.0- resolution:- {- integrity: sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==,- }- engines: { node: '>=10' }- dev: false-resolution:{@@ -18530,6 +18418,7 @@ packages:{integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==,}+ dev: trueresolution:diff --git a/web/store/index.ts b/web/store/index.tsindex 3b721115..0659a762 100644--- a/web/store/index.ts+++ b/web/store/index.ts@@ -300,21 +300,21 @@ export const actions = {})await context.dispatch('getHeartbeat')- await context.commit('setThreads', response.data.data)+ context.commit('setThreads', response.data.data)},async loadBillingUsage(context: ActionContext<State, State>) {const response = await axios.get('/v1/billing/usage')- await context.commit('setBillingUsage', response.data.data)+ context.commit('setBillingUsage', response.data.data)},async loadBillingUsageHistory(context: ActionContext<State, State>) {const response = await axios.get('/v1/billing/usage-history')- await context.commit('setBillingUsageHistory', response.data.data)+ context.commit('setBillingUsageHistory', response.data.data)},- async toggleArchive(context: ActionContext<State, State>) {- await context.commit('setArchivedThreads', !context.getters.getIsArchived)+ toggleArchive(context: ActionContext<State, State>) {+ context.commit('setArchivedThreads', !context.getters.getIsArchived)},async loadPhones(context: ActionContext<State, State>, force: boolean) {@@ -381,15 +381,16 @@ export const actions = {context: ActionContext<State, State>,error: AxiosError,) {- const errorMessage =- error.response?.data?.data[Object.keys(error.response?.data?.data)[0]][0]+ const errorMessage = (error.response?.data as any)?.data[+ Object.keys((error.response?.data as any)?.data)[0]+ ][0]await context.dispatch('addNotification', {message:(errorMessage ? errorMessage.replaceAll('_', ' ') : null) ??- error.response?.data.message,+ (error.response?.data as any)?.message,type: 'error',})- await context.commit('setAxiosError', error)+ context.commit('setAxiosError', error)},getHeartbeat(@@ -415,7 +416,7 @@ export const actions = {.catch(async (error: AxiosError) => {await context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Errors while fetching heartbeat',type: 'error',})@@ -441,7 +442,7 @@ export const actions = {} catch (e) {await context.dispatch('addNotification', {message:- (e as AxiosError).response?.data?.message ??+ ((e as AxiosError).response?.data as any)?.message ??'Error while sending message',type: 'error',})@@ -484,7 +485,8 @@ export const actions = {.catch(async (error: AxiosError) => {await context.dispatch('addNotification', {message:- error.response?.data?.message ?? 'Errors while fetching messages',+ (error.response?.data as any)?.message ??+ 'Errors while fetching messages',type: 'error',})reject(error)@@ -599,7 +601,7 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Error while fetching the update URL',type: 'error',}),@@ -620,7 +622,7 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Error while cancelling your subscription',type: 'error',}),@@ -644,7 +646,7 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Error while adding discord integration',type: 'error',}),@@ -669,7 +671,7 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Error while fetching discord integrations',type: 'error',}),@@ -696,7 +698,7 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Error while updating discord integration',type: 'error',}),@@ -720,7 +722,7 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Error while deleting discord integration',type: 'error',}),@@ -744,7 +746,8 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ?? 'Error while adding webhook',+ (error.response?.data as any)?.message ??+ 'Error while adding webhook',type: 'error',}),])@@ -768,7 +771,7 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ??+ (error.response?.data as any)?.message ??'Error while fetching webhooks',type: 'error',}),@@ -792,7 +795,8 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ?? 'Error while updating webhook',+ (error.response?.data as any)?.message ??+ 'Error while updating webhook',type: 'error',}),])@@ -812,7 +816,8 @@ export const actions = {await Promise.all([context.dispatch('addNotification', {message:- error.response?.data?.message ?? 'Error while deleting webhook',+ (error.response?.data as any)?.message ??+ 'Error while deleting webhook',type: 'error',}),])