feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -1,12 +1,12 @@
import verifyCredentials from './verify-credentials';
import isStillVerified from './is-still-verified';
import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified.js';
export default {
fields: [
{
key: 'screenName',
label: 'Screen Name',
type: 'string' as const,
type: 'string',
required: true,
readOnly: false,
value: null,
@@ -18,7 +18,7 @@ export default {
{
key: 'userKey',
label: 'User Key',
type: 'string' as const,
type: 'string',
required: true,
readOnly: false,
value: null,
@@ -29,7 +29,7 @@ export default {
{
key: 'apiToken',
label: 'API Token',
type: 'string' as const,
type: 'string',
required: true,
readOnly: false,
value: null,

View File

@@ -0,0 +1,8 @@
import verifyCredentials from './verify-credentials.js';
const isStillVerified = async ($) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,9 +0,0 @@
import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,11 +1,10 @@
import { IGlobalVariable } from '@automatisch/types';
import HttpError from '../../../errors/http';
import HttpError from '../../../errors/http.js';
const verifyCredentials = async ($: IGlobalVariable) => {
const verifyCredentials = async ($) => {
try {
await $.http.post(`/1/users/validate.json`, {
token: $.auth.data.apiToken as string,
user: $.auth.data.userKey as string,
token: $.auth.data.apiToken,
user: $.auth.data.userKey,
});
} catch (error) {
const noDeviceError = 'user is valid but has no active devices';