This commit is contained in:
JesmoDev
2022-05-17 13:29:21 +02:00
7 changed files with 37 additions and 24 deletions

View File

@@ -1 +0,0 @@
[{"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\index.html":"1","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\auth\\login\\umb-login.element.ts":"2","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\auth\\umb-auth-layout.element.ts":"3","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\mocks\\browser.ts":"4","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\mocks\\handlers.ts":"5","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\umb-app.ts":"6","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\vite-env.d.ts":"7","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\vite.config.ts":"8"},{"size":439,"mtime":1652780722735,"results":"9","hashOfConfig":"10"},{"size":3548,"mtime":1652780966102,"results":"11","hashOfConfig":"12"},{"size":1583,"mtime":1652780143916,"results":"13","hashOfConfig":"12"},{"size":125,"mtime":1652778625829,"results":"14","hashOfConfig":"12"},{"size":1124,"mtime":1652778625830,"results":"15","hashOfConfig":"12"},{"size":1333,"mtime":1652784785309,"results":"16","hashOfConfig":"12"},{"size":38,"mtime":1652772071662,"results":"17","hashOfConfig":"12"},{"size":101,"mtime":1652777797494,"results":"18","hashOfConfig":"19"},{"filePath":"20","messages":"21","suppressedMessages":"22","errorCount":1,"fatalErrorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"19l7quh",{"filePath":"23","messages":"24","suppressedMessages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1bd46in",{"filePath":"26","messages":"27","suppressedMessages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","suppressedMessages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","suppressedMessages":"34","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","suppressedMessages":"37","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"38","messages":"39","suppressedMessages":"40","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"41","messages":"42","suppressedMessages":"43","errorCount":1,"fatalErrorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"yvcwes","C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\index.html",["44"],[],"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\auth\\login\\umb-login.element.ts",[],[],"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\auth\\umb-auth-layout.element.ts",[],[],"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\mocks\\browser.ts",[],[],"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\mocks\\handlers.ts",[],[],"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\umb-app.ts",["45"],[],"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\src\\vite-env.d.ts",[],[],"C:\\Users\\Umbraco\\Documents\\Git\\Umbraco.CMS.Backoffice\\vite.config.ts",["46"],[],{"ruleId":null,"fatal":true,"severity":2,"message":"47","line":1,"column":10},{"ruleId":"48","severity":1,"message":"49","line":25,"column":10,"nodeType":"50","messageId":"51","endLine":25,"endColumn":13,"suggestions":"52"},{"ruleId":null,"fatal":true,"severity":2,"message":"53"},"Parsing error: '>' expected.","@typescript-eslint/no-explicit-any","Unexpected any. Specify a different type.","TSAnyKeyword","unexpectedAny",["54","55"],"Parsing error: \"parserOptions.project\" has been set for @typescript-eslint/parser.\nThe file does not match your project config: vite.config.ts.\nThe file must be included in at least one of the projects provided.",{"messageId":"56","fix":"57","desc":"58"},{"messageId":"59","fix":"60","desc":"61"},"suggestUnknown",{"range":"62","text":"63"},"Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.","suggestNever",{"range":"62","text":"64"},"Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.",[539,542],"unknown","never"]

View File

@@ -10,6 +10,7 @@ lerna-debug.log*
node_modules
dist
dist-ssr
types
*.local
# Editor directories and files
@@ -22,3 +23,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
# eslint
.eslintcache

View File

@@ -22,6 +22,10 @@
"prettier": "2.6.2",
"typescript": "^4.5.4",
"vite": "^2.9.9"
},
"engines": {
"node": ">=16.0.0 <17",
"npm": ">=8.0.0 < 9"
}
},
"node_modules/@babel/code-frame": {

View File

@@ -8,6 +8,10 @@
"test": "echo 'TODO: Implement test'",
"lint": "eslint --cache --ext .ts . --ignore-path .gitignore"
},
"engines": {
"node": ">=16.0.0 <17",
"npm": ">=8.0.0 < 9"
},
"dependencies": {
"@umbraco-ui/uui": "^0.2.0",
"lit": "^2.0.2"
@@ -27,4 +31,4 @@
"msw": {
"workerDirectory": "public"
}
}
}

View File

@@ -1,7 +1,7 @@
import { rest } from 'msw';
export const handlers = [
rest.post('/login', (req, res, ctx) => {
rest.post('/login', (_req, res, ctx) => {
// Persist user's authentication in the session
sessionStorage.setItem('is-authenticated', 'true');
return res(
@@ -10,7 +10,7 @@ export const handlers = [
)
}),
rest.post('/logout', (req, res, ctx) => {
rest.post('/logout', (_req, res, ctx) => {
// Persist user's authentication in the session
sessionStorage.removeItem('is-authenticated');
return res(
@@ -19,7 +19,7 @@ export const handlers = [
)
}),
rest.get('/user', (req, res, ctx) => {
rest.get('/user', (_req, res, ctx) => {
// Check if the user is authenticated in this session
const isAuthenticated = sessionStorage.getItem('is-authenticated');
if (!isAuthenticated) {

View File

@@ -1,14 +1,14 @@
import './auth/login/umb-login.element';
import './auth/umb-auth-layout.element';
import '@umbraco-ui/uui';
import '@umbraco-ui/uui-css/dist/uui-css.css';
import { html, css, LitElement } from 'lit';
import { css, html, LitElement } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { worker } from './mocks/browser';
// Import somewhere else?
import '@umbraco-ui/uui';
import './auth/login/umb-login.element';
import './auth/umb-auth-layout.element';
@customElement('umb-app')
export class UmbApp extends LitElement {
static styles = css`
@@ -29,15 +29,6 @@ export class UmbApp extends LitElement {
worker.start();
}
private _onLogout() {
try {
fetch('/logout', { method: 'POST' });
this._authorized = false;
} catch (error) {
console.log(error);
}
}
private async _getUser() {
try {
const res = await fetch('/user');

View File

@@ -1,9 +1,14 @@
{
"compilerOptions": {
"module": "esnext",
"lib": ["es2017", "dom", "dom.iterable"],
"lib": [
"es2017",
"dom",
"dom.iterable"
],
"declaration": true,
"emitDeclarationOnly": true,
"noEmitOnError": true,
"outDir": "./types",
"strict": true,
"noUnusedLocals": true,
@@ -18,6 +23,12 @@
"useDefineForClassFields": false,
"skipLibCheck": true
},
"include": ["src/**/*.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
"include": [
"src/**/*.ts"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}