This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // USAGE: | |
| // import_code("path/to/findindex.src") | |
| // list = [item, item, item] | |
| // somefunction = function (item, value) | |
| // return item.something == value | |
| // end function | |
| // | |
| // index = find_index(list, value, @somefunction) | |
| find_index = function (list, value, fn) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if params.len != 1 then | |
| exit("Usage: connectnetwork [network_device]") | |
| end if | |
| network_device = params[0] | |
| // START | |
| crypto = include_lib("/lib/crypto.so") | |
| if not crypto then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async handleSubmit (e) { | |
| // after nung console.log(values) | |
| const { username, password } = values; | |
| // window.fetch MDN docs | |
| const response = await fetch('http://localhost:8080/auth/login', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-type': 'application/json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { html } from 'lit'; | |
| import { Page as BlogPage } from '../blog/index.js' | |
| export class Page extends BlogPage { | |
| async editBlog (event) { | |
| event.preventDefault(); | |
| const { _id } = this.blog || {}; | |
| const { target: form } = event; | |
| const title = form.title.value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { LitElement, html } from 'lit'; | |
| import { proxy } from 'comlink'; | |
| import { state } from '../../worker/index.js'; | |
| export class Component extends LitElement { | |
| // ... constructor | |
| async connectedCallback () { | |
| super.connectedCallback(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { home } from './base/home.js'; | |
| import { createBlog } from './blog/create-blog.js'; | |
| import { getBlog } from './blog/get-blog.js'; | |
| import { getManyBlog } from './blog/get-many-blog.js'; | |
| import { updateBlog } from './blog/update-blog.js'; | |
| import { deleteBlog } from './blog/delete-blog.js'; | |
| import { createUser } from './user/create-blog.js'; | |
| import { login } from './auth/login.js' | |
| import { logout } from './auth/logout.js' | |
| import { checkAuth } from './auth/check-auth.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export async function checkAuth (request) { | |
| const { user } = request; | |
| const { username } = user; | |
| return { | |
| success: true, | |
| username | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // import { root } from './root/index.js'; | |
| import { blog } from './blog/index.js'; | |
| import { blogId } from './blog/_id/index.js'; | |
| import { user } from './user/index.js'; | |
| import { authLogin, authLogout, checkAuth } from './auth/index.js'; | |
| export const paths = { | |
| // '/': root, | |
| '/blog': blog, | |
| '/blog/:id': blogId, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { post } from './login/index.js'; | |
| import { get } from './logout/index.js'; | |
| import { get as getCheckAuth } from './check-auth/index.js' | |
| export const authLogin = { | |
| post | |
| }; | |
| export const authLogout = { | |
| get |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const get = { | |
| description: 'Check authentication of a user', | |
| operationId: 'checkAuth', | |
| tags: [ | |
| 'Auth' | |
| ], | |
| responses: { | |
| 200: { | |
| description: 'Check authentication of a user', | |
| content: { |