This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cb18ca
commit eb236cf
Showing
33 changed files
with
259 additions
and
151 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,6 @@ | |
.DS_Store | ||
Thumbs.db | ||
build | ||
dist | ||
dist | ||
|
||
client/config.js |
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const config = { | ||
rest_url: 'https://conduit.productionready.io/api/' | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const config = { | ||
rest_url: 'https://conduit.productionready.io/api/' | ||
}; |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import {layoutComponents} from "../components/layout/index"; | ||
import {ArticleComponent} from "../components/article.comp"; | ||
import {HomeComponent} from "../pages/home.comp"; | ||
import {CLoginComponent} from "../pages/login.comp"; | ||
import {CRegisterComponent} from "../pages/register.comp"; | ||
import {RouterOutlet} from "../router/router-outlet"; | ||
import {ComponentRegistry} from "./component-registry"; | ||
import {ProfileComponent} from "../pages/profile.comp"; | ||
import {ArticlePreviewComponent} from "../pages/article-preview.comp"; | ||
import {CommentPreviewComponent} from "../components/comment-preview.comp"; | ||
import {EditorComponent} from "../pages/editor.comp"; | ||
import {SettingsComponent} from "../pages/settings.comp"; | ||
import {PopularTagsComponent} from "../components/popular-tags.comp"; | ||
import {CommentsContainerComponent} from "../components/comments-container.comp"; | ||
|
||
export class Core { | ||
constructor() { | ||
if (!Core.inst) { | ||
Core.inst = this; | ||
} else { | ||
throw new Error('use instance'); | ||
} | ||
|
||
ComponentRegistry.register(components); | ||
|
||
return Core.inst; | ||
} | ||
|
||
static get instance() { | ||
return Core.inst; | ||
} | ||
} | ||
Core.inst = null; | ||
|
||
const components = [ | ||
...layoutComponents, | ||
{ | ||
tagName: 'c-article', | ||
component: ArticleComponent | ||
}, | ||
{ | ||
tagName: 'router-outlet', | ||
component: RouterOutlet | ||
}, | ||
{ | ||
tagName: 'c-home', | ||
component: HomeComponent | ||
}, | ||
{ | ||
tagName: 'c-login', | ||
component: CLoginComponent | ||
}, | ||
{ | ||
tagName: 'c-register', | ||
component: CRegisterComponent | ||
}, | ||
{ | ||
tagName: 'c-profile', | ||
component: ProfileComponent | ||
}, | ||
{ | ||
tagName: 'article-preview', | ||
component: ArticlePreviewComponent | ||
}, | ||
{ | ||
tagName: 'comment-preview', | ||
component: CommentPreviewComponent | ||
}, | ||
{ | ||
tagName: 'comments-container', | ||
component: CommentsContainerComponent | ||
}, | ||
{ | ||
tagName: 'c-editor', | ||
component: EditorComponent | ||
}, | ||
{ | ||
tagName: 'c-settings', | ||
component: SettingsComponent | ||
}, | ||
{ | ||
tagName: 'popular-tags', | ||
component: PopularTagsComponent | ||
} | ||
]; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {Authentication} from "../auth/authentication"; | ||
import {config} from '../config'; | ||
|
||
export class Http { | ||
constructor() { | ||
if (!Http.inst) { | ||
Http.inst = this; | ||
} else { | ||
throw new Error('use instance'); | ||
} | ||
|
||
return Http.inst; | ||
} | ||
|
||
static get instance() { | ||
return Http.inst; | ||
} | ||
|
||
doGet(path, authentication) { | ||
const headers = { | ||
'Accept': 'application/json, text/plain, */*', | ||
'Content-Type': 'application/json', | ||
}; | ||
|
||
if(authentication === true) { | ||
headers['Authorization'] = 'Token ' + Authentication.instance.auth.token; | ||
} | ||
return fetch(config.rest_url + path, { | ||
headers: headers | ||
}); | ||
} | ||
} | ||
Http.inst = null; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {RouterHandler} from "./router/router-handler"; | ||
import {Authentication} from "./auth/authentication"; | ||
import {Core} from "./core/core"; | ||
import {Http} from "./http/http"; | ||
|
||
/** | ||
* Order is important ! | ||
*/ | ||
class App { | ||
constructor() { | ||
new Authentication(); | ||
const router = new RouterHandler(); | ||
new Core(); | ||
new Http(); | ||
router.init(); | ||
} | ||
} | ||
|
||
new App(); |
This file contains 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
File renamed without changes.
This file contains 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
Oops, something went wrong.