-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
22 changed files
with
246 additions
and
55 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
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
22 changes: 22 additions & 0 deletions
22
frontend/nos-crossposting-service-frontend/src/components/CurrentUser.vue
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,22 @@ | ||
<template> | ||
<div class="current-user"> | ||
You are logged in as {{ user.accountID }}. | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {Options, Vue} from 'vue-class-component'; | ||
import {User} from "@/dto/User"; | ||
@Options({ | ||
props: { | ||
user: User | ||
}, | ||
}) | ||
export default class CurrentUser extends Vue { | ||
user!: User | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
5 changes: 5 additions & 0 deletions
5
frontend/nos-crossposting-service-frontend/src/dto/CurrentUser.ts
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,5 @@ | ||
import {User} from "@/dto/User"; | ||
|
||
export class CurrentUser { | ||
user?: User; | ||
} |
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,4 @@ | ||
export class User { | ||
accountID?: string; | ||
twitterID?: number; | ||
} |
31 changes: 31 additions & 0 deletions
31
frontend/nos-crossposting-service-frontend/src/services/APIService.ts
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,31 @@ | ||
import axios, {AxiosResponse} from 'axios'; | ||
import {CurrentUser} from "@/dto/CurrentUser"; | ||
import {Mutation} from '@/store'; | ||
|
||
export class APIService { | ||
|
||
private readonly axios = axios.create(); | ||
|
||
constructor(private store: any) { | ||
} | ||
|
||
currentUser(): Promise<AxiosResponse<CurrentUser>> { | ||
const url = `/api/current-user`; | ||
return this.axios.get<CurrentUser>(url); | ||
} | ||
|
||
refreshCurrentUser(): Promise<CurrentUser> { | ||
return new Promise((resolve, reject) => { | ||
this.currentUser() | ||
.then( | ||
response => { | ||
this.store.commit(Mutation.SetUser, response.data.user); | ||
resolve(response.data); | ||
}, | ||
error => { | ||
reject(error); | ||
}, | ||
); | ||
}); | ||
} | ||
} |
32 changes: 21 additions & 11 deletions
32
frontend/nos-crossposting-service-frontend/src/store/index.ts
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 |
---|---|---|
@@ -1,14 +1,24 @@ | ||
import { createStore } from 'vuex' | ||
import {createStore} from 'vuex' | ||
import {User} from "@/dto/User"; | ||
|
||
export enum Mutation { | ||
SetUser = 'setUser', | ||
} | ||
|
||
export class State { | ||
user?: User; | ||
} | ||
|
||
export default createStore({ | ||
state: { | ||
}, | ||
getters: { | ||
}, | ||
mutations: { | ||
}, | ||
actions: { | ||
}, | ||
modules: { | ||
} | ||
state: { | ||
user: undefined, | ||
}, | ||
getters: {}, | ||
mutations: { | ||
[Mutation.SetUser](state: State, user: User): void { | ||
state.user = user; | ||
}, | ||
}, | ||
actions: {}, | ||
modules: {} | ||
}) |
30 changes: 28 additions & 2 deletions
30
frontend/nos-crossposting-service-frontend/src/views/HomeView.vue
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 |
---|---|---|
@@ -1,21 +1,47 @@ | ||
<template> | ||
<div class="home"> | ||
<Explanation/> | ||
<LogInWithTwitterButton/> | ||
<div v-if="loading"> | ||
Loading... | ||
</div> | ||
|
||
<div v-if="!loading && !user"> | ||
<Explanation/> | ||
<LogInWithTwitterButton/> | ||
</div> | ||
|
||
<div v-if="!loading && user"> | ||
<CurrentUser :user="user"/> | ||
</div> | ||
|
||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {Options, Vue} from 'vue-class-component'; | ||
import {useStore} from "vuex"; | ||
import Explanation from '@/components/Explanation.vue'; | ||
import LogInWithTwitterButton from "@/components/LogInWithTwitterButton.vue"; | ||
import {User} from "@/dto/User"; | ||
import CurrentUser from "@/components/CurrentUser.vue"; | ||
@Options({ | ||
components: { | ||
CurrentUser, | ||
LogInWithTwitterButton, | ||
Explanation, | ||
}, | ||
}) | ||
export default class HomeView extends Vue { | ||
private readonly store = useStore(); | ||
get loading(): boolean { | ||
return this.store.state.user === undefined; | ||
} | ||
get user(): User { | ||
return this.store.state.user; | ||
} | ||
} | ||
</script> |
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 |
---|---|---|
|
@@ -2134,6 +2134,11 @@ async@^2.6.4: | |
dependencies: | ||
lodash "^4.17.14" | ||
|
||
asynckit@^0.4.0: | ||
version "0.4.0" | ||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" | ||
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== | ||
|
||
at-least-node@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" | ||
|
@@ -2151,6 +2156,15 @@ autoprefixer@^10.2.4: | |
picocolors "^1.0.0" | ||
postcss-value-parser "^4.2.0" | ||
|
||
axios@^1.5.1: | ||
version "1.5.1" | ||
resolved "https://registry.yarnpkg.com/axios/-/axios-1.5.1.tgz#11fbaa11fc35f431193a9564109c88c1f27b585f" | ||
integrity sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A== | ||
dependencies: | ||
follow-redirects "^1.15.0" | ||
form-data "^4.0.0" | ||
proxy-from-env "^1.1.0" | ||
|
||
babel-loader@^8.2.2: | ||
version "8.3.0" | ||
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.3.0.tgz#124936e841ba4fe8176786d6ff28add1f134d6a8" | ||
|
@@ -2517,6 +2531,13 @@ colorette@^2.0.10: | |
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" | ||
integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== | ||
|
||
combined-stream@^1.0.8: | ||
version "1.0.8" | ||
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" | ||
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== | ||
dependencies: | ||
delayed-stream "~1.0.0" | ||
|
||
commander@^2.20.0: | ||
version "2.20.3" | ||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" | ||
|
@@ -2875,6 +2896,11 @@ define-properties@^1.1.4: | |
has-property-descriptors "^1.0.0" | ||
object-keys "^1.1.1" | ||
|
||
delayed-stream@~1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" | ||
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== | ||
|
||
[email protected]: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" | ||
|
@@ -3452,7 +3478,7 @@ flatted@^3.2.9: | |
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" | ||
integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== | ||
|
||
follow-redirects@^1.0.0: | ||
follow-redirects@^1.0.0, follow-redirects@^1.15.0: | ||
version "1.15.3" | ||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" | ||
integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== | ||
|
@@ -3476,6 +3502,15 @@ fork-ts-checker-webpack-plugin@^6.4.0: | |
semver "^7.3.2" | ||
tapable "^1.0.0" | ||
|
||
form-data@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" | ||
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== | ||
dependencies: | ||
asynckit "^0.4.0" | ||
combined-stream "^1.0.8" | ||
mime-types "^2.1.12" | ||
|
||
[email protected]: | ||
version "0.2.0" | ||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" | ||
|
@@ -4396,7 +4431,7 @@ [email protected], "mime-db@>= 1.43.0 < 2": | |
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" | ||
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== | ||
|
||
mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: | ||
mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: | ||
version "2.1.35" | ||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" | ||
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== | ||
|
@@ -5170,6 +5205,11 @@ proxy-addr@~2.0.7: | |
forwarded "0.2.0" | ||
ipaddr.js "1.9.1" | ||
|
||
proxy-from-env@^1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" | ||
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== | ||
|
||
pseudomap@^1.0.2: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package internal | ||
|
||
func Pointer[T any](v T) *T { | ||
return &v | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>nos-crossposting-service-frontend</title><script defer="defer" src="/js/chunk-vendors.67842d50.js"></script><script defer="defer" src="/js/app.15f678df.js"></script><link href="/css/app.ddbde395.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but nos-crossposting-service-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> | ||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>nos-crossposting-service-frontend</title><script defer="defer" src="/js/chunk-vendors.6ebd820c.js"></script><script defer="defer" src="/js/app.1a52fb73.js"></script><link href="/css/app.ddbde395.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but nos-crossposting-service-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.