parent
							
								
									5896c35d54
								
							
						
					
					
						commit
						b2008bb866
					
				
				 11 changed files with 150 additions and 76 deletions
			
			
		@ -1,3 +1,5 @@ | 
				
			|||||||
 | 
					'use strict'; | 
				
			||||||
export const SpaceTraders = { | 
					export const SpaceTraders = { | 
				
			||||||
        host: "https://api.spacetraders.io/v2/" | 
					        host: "https://api.spacetraders.io/v2/", | 
				
			||||||
 | 
					        limit_max: 20, | 
				
			||||||
} | 
					} | 
				
			||||||
@ -0,0 +1,3 @@ | 
				
			|||||||
 | 
					export class Planet { | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,3 @@ | 
				
			|||||||
 | 
					export class System { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,13 @@ | 
				
			|||||||
 | 
					// Copyright © 2023 Entreprise SkamKraft
 | 
				
			||||||
 | 
					'use strict'; | 
				
			||||||
 | 
					export class Initialzer { | 
				
			||||||
 | 
					    constructor(UI) { | 
				
			||||||
 | 
					        this.UI = UI; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    init_menu_link(tag, template) { | 
				
			||||||
 | 
					        this.UI.add_event(tag, "click", () => { | 
				
			||||||
 | 
					            this.UI.render(`templates/${template}`); | 
				
			||||||
 | 
					        })    
 | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -1,19 +1,34 @@ | 
				
			|||||||
import {UIRenderer} from "./ui/templeting_engine.js"; | 
					// Copyright © 2023 Entreprise SkamKraft
 | 
				
			||||||
 | 
					'use strict'; | 
				
			||||||
 | 
					import { UIRenderer } from "./ui/templeting_engine.js"; | 
				
			||||||
 | 
					import { Initialzer } from "./commun/commun.js"; | 
				
			||||||
 | 
					import { AgentBuilder } from "./api/agent.js"; | 
				
			||||||
 | 
					import { Auth } from "./auth/auth.js"; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGlmaWVyIjoiSEFSRElDSyIsInZlcnNpb24iOiJ2Mi4xLjQiLCJyZXNldF9kYXRlIjoiMjAyMy0xMi0wMiIsImlhdCI6MTcwMjY2Mjc2Mywic3ViIjoiYWdlbnQtdG9rZW4ifQ.PrvaOz3W79acq6RoxryMW53PRRz824_AM0VGLwfXCOsGCOCAIY-rn6-bZTOnLAtp4xPSDqEk4c38oWYAWW59p0iMDDLpur6ONnjT0RjjsQS9zr5BByfBpP36CT23IZSSzk3XxGrFolHJAyU3K1liYfNbsPuNTXlkHGNHq6yMqH4ZQUPFsXEsCkg9cUynkdLw3C39SvWhtJ89oblj_8tQp2k8dxhZemepuXtiI51eFMpv8A0WRAi7pVYo_ajJujY9QDLYn_m5hDZWTlQMIstjPaDl99p2IMweIMO2Q2G-0lKiWQ4sl6VW5tuVrz1HLYU6kyMjFQWNn6kFDE7LWMTrfw"; | 
				
			||||||
let UI = new UIRenderer("html"); | 
					let UI = new UIRenderer("html"); | 
				
			||||||
UI.render("templates/home.html") | 
					let initer = new Initialzer(UI); | 
				
			||||||
 | 
					UI.render("templates/home.html"); | 
				
			||||||
 | 
					
 | 
				
			||||||
function init_menu_link(tag, template) { | 
					let auth = new Auth(); | 
				
			||||||
    UI.add_event(tag, "click", () => { | 
					auth.done((agent) => { | 
				
			||||||
        UI.render(`templates/${template}`); | 
					    console.log(agent); | 
				
			||||||
    })    
 | 
					}).fail((errs) => { | 
				
			||||||
} | 
					    errs.forEach(err => { | 
				
			||||||
 | 
					        console.log(err); | 
				
			||||||
 | 
					    }); | 
				
			||||||
 | 
					}); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					await auth.register({ | 
				
			||||||
 | 
					    symbol: "lkdsjfsjdlfjlk", | 
				
			||||||
 | 
					    faction: "COSMIC" | 
				
			||||||
 | 
					}); | 
				
			||||||
 | 
					
 | 
				
			||||||
$(document).ready(() => { | 
					$(document).ready(() => { | 
				
			||||||
    init_menu_link("#contracts-link", "contracts.html"); | 
					    initer.init_menu_link("#contracts-link", "contracts.html"); | 
				
			||||||
    init_menu_link("#ships-link", "ships.html"); | 
					    initer.init_menu_link("#ships-link", "ships.html"); | 
				
			||||||
    init_menu_link("#systems-link", "systems.html"); | 
					    initer.init_menu_link("#systems-link", "systems.html"); | 
				
			||||||
    init_menu_link("#signup-link", "register.html"); | 
					    initer.init_menu_link("#signup-link", "register.html"); | 
				
			||||||
    init_menu_link("#signin-link", "login.html"); | 
					    initer.init_menu_link("#signin-link", "login.html"); | 
				
			||||||
    init_menu_link(".nav-brand", "home.html"); | 
					    initer.init_menu_link(".nav-brand", "home.html"); | 
				
			||||||
}); | 
					}); | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue