diff --git a/packages/api/globalConfig.json b/packages/api/globalConfig.json index 57e017fd..d6f2bf81 100644 --- a/packages/api/globalConfig.json +++ b/packages/api/globalConfig.json @@ -1 +1,3 @@ -{"mongoUri":"mongodb://127.0.0.1:62752/e64cf421-d3ec-458c-86fa-c802e9186b31?"} \ No newline at end of file +{ + "mongoUri": "mongodb://127.0.0.1:62752/e64cf421-d3ec-458c-86fa-c802e9186b31?" +} diff --git a/packages/authentication/globalConfig.json b/packages/authentication/globalConfig.json index 142a0b6a..edf23e08 100644 --- a/packages/authentication/globalConfig.json +++ b/packages/authentication/globalConfig.json @@ -1 +1,3 @@ -{"mongoUri":"mongodb://127.0.0.1:62885/d1125fff-a42a-4f60-a9ee-4433eb22868e?"} \ No newline at end of file +{ + "mongoUri": "mongodb://127.0.0.1:62885/d1125fff-a42a-4f60-a9ee-4433eb22868e?" +} diff --git a/packages/authentication/src/routes/user-routes.test.ts b/packages/authentication/src/routes/user-routes.test.ts index 49be2d10..518b6552 100644 --- a/packages/authentication/src/routes/user-routes.test.ts +++ b/packages/authentication/src/routes/user-routes.test.ts @@ -16,7 +16,6 @@ import { app } from "../app"; import { hash } from "../cryptography/cryptography"; import { credentialsAreValid } from "./user-routes"; - const signUp = ( credentials = test.mocks.credentials(), agent = supertest.agent(app) @@ -28,18 +27,14 @@ const extractBearerToken = async (test: supertest.Test) => { } = await test; return token; +}; -} - - const login = (credentials = test.mocks.credentials(), agent = supertest.agent(app)) => - agent - .post("/users/sessions") - .send(credentials as any); - +const login = ( + credentials = test.mocks.credentials(), + agent = supertest.agent(app) +) => agent.post("/users/sessions").send(credentials as any); describe("The authentication endpoint for users", () => { - - describe("Local test utils", () => { describe("extractBearerToken", () => { it("Does extract something defined", async () => { @@ -226,187 +221,182 @@ describe("The authentication endpoint for users", () => { }); it("returns BAD_REQUEST on users that don't have valid email addresses", async () => { + const { status } = await signUp({ + ...test.mocks.credentials(), + email: "notemail.com", + }); - const { status } = await signUp({ - ...test.mocks.credentials(), - email: "notemail.com" - }); - - expect(status).toEqual(BAD_REQUEST); + expect(status).toEqual(BAD_REQUEST); }); }); - describe("POST endpoint for creating new sessions",() => { - - it("Does respond with 201 on succesful request", async () => { - - const credentials = test.mocks.credentials(); - await signUp(credentials); - - const { status } = await login(credentials); - expect(status).toBe(CREATED); - }); - - it("Does respond with 401 if credentials are invalid", async () => { - - const credentials = test.mocks.credentials(); - //NOTE: not signing up + describe("POST endpoint for creating new sessions", () => { + it("Does respond with 201 on succesful request", async () => { + const credentials = test.mocks.credentials(); + await signUp(credentials); - const { status } = await login(credentials); - expect(status).toBe(UNAUTHORIZED); - }) + const { status } = await login(credentials); + expect(status).toBe(CREATED); }); - it("Does create a user, but does not store the password", async () => { + it("Does respond with 401 if credentials are invalid", async () => { const credentials = test.mocks.credentials(); - const { status } = await signUp(credentials); - expect(status).toEqual(CREATED); + //NOTE: not signing up - const user = await database.users.getByEmail(credentials.email); - expect(user.password_hash).not.toEqual(credentials.password); + const { status } = await login(credentials); + expect(status).toBe(UNAUTHORIZED); }); + }); - it("Does create a user and stores hash comparable with bcrypt", async () => { - const credentials = test.mocks.credentials(); - const { status } = await signUp(credentials); - expect(status).toEqual(CREATED); + it("Does create a user, but does not store the password", async () => { + const credentials = test.mocks.credentials(); + const { status } = await signUp(credentials); + expect(status).toEqual(CREATED); - const user = await database.users.getByEmail(credentials.email); - expect(await hash.compare(credentials.password, user.password_hash)).toBe( - true - ); - }); + const user = await database.users.getByEmail(credentials.email); + expect(user.password_hash).not.toEqual(credentials.password); + }); - it("Responds with CONFLICT if attempting to create the same user twice", async () => { - const credentials = test.mocks.credentials(); - const firstResponse = await signUp(credentials); - expect(firstResponse.status).toEqual(CREATED); + it("Does create a user and stores hash comparable with bcrypt", async () => { + const credentials = test.mocks.credentials(); + const { status } = await signUp(credentials); + expect(status).toEqual(CREATED); - const secondResponse = await signUp(credentials); - expect(secondResponse.status).toEqual(CONFLICT); - }); + const user = await database.users.getByEmail(credentials.email); + expect(await hash.compare(credentials.password, user.password_hash)).toBe( + true + ); + }); - it("Returns BAD_REQUEST on users that have passwords shorter than 8 characters", async () => { - const { status } = await signUp({ - ...test.mocks.credentials(), - password: faker.random.alphaNumeric(7), - }); + it("Responds with CONFLICT if attempting to create the same user twice", async () => { + const credentials = test.mocks.credentials(); + const firstResponse = await signUp(credentials); + expect(firstResponse.status).toEqual(CREATED); - expect(status).toEqual(BAD_REQUEST); + const secondResponse = await signUp(credentials); + expect(secondResponse.status).toEqual(CONFLICT); + }); + + it("Returns BAD_REQUEST on users that have passwords shorter than 8 characters", async () => { + const { status } = await signUp({ + ...test.mocks.credentials(), + password: faker.random.alphaNumeric(7), }); - it("returns BAD_REQUEST on users that have passwords without lowercase letters", async () => { - const { status } = await signUp({ - ...test.mocks.credentials(), - password: faker.random.alphaNumeric(80).toLowerCase(), - }); + expect(status).toEqual(BAD_REQUEST); + }); - expect(status).toEqual(BAD_REQUEST); + it("returns BAD_REQUEST on users that have passwords without lowercase letters", async () => { + const { status } = await signUp({ + ...test.mocks.credentials(), + password: faker.random.alphaNumeric(80).toLowerCase(), }); - it("returns BAD_REQUEST on users that have passwords without uppercase letters", async () => { - const { status } = await signUp({ - ...test.mocks.credentials(), - password: faker.random.alphaNumeric(80).toUpperCase(), - }); + expect(status).toEqual(BAD_REQUEST); + }); - expect(status).toEqual(BAD_REQUEST); + it("returns BAD_REQUEST on users that have passwords without uppercase letters", async () => { + const { status } = await signUp({ + ...test.mocks.credentials(), + password: faker.random.alphaNumeric(80).toUpperCase(), }); - it("returns BAD_REQUEST on users that don't have numbers", async () => { - const { status } = await signUp({ - ...test.mocks.credentials(), - password: faker.random.alpha({ count: 50 }), - }); + expect(status).toEqual(BAD_REQUEST); + }); - expect(status).toEqual(BAD_REQUEST); + it("returns BAD_REQUEST on users that don't have numbers", async () => { + const { status } = await signUp({ + ...test.mocks.credentials(), + password: faker.random.alpha({ count: 50 }), }); + + expect(status).toEqual(BAD_REQUEST); }); +}); - describe("GET endpoint for retrieving information about the logged in user", () => { - const getMe = (token: string, agent = supertest(app)) => - agent.get("/users/me").set("Authorization", "Bearer " + token); +describe("GET endpoint for retrieving information about the logged in user", () => { + const getMe = (token: string, agent = supertest(app)) => + agent.get("/users/me").set("Authorization", "Bearer " + token); - it("Responds with UNAUTHORIZED if the user is not logged in", async () => { - const { status } = await getMe(null); - expect(status).toEqual(UNAUTHORIZED); - }); + it("Responds with UNAUTHORIZED if the user is not logged in", async () => { + const { status } = await getMe(null); + expect(status).toEqual(UNAUTHORIZED); + }); - it("Resopnds with FORBIDDEN if the JWT token is present, but not valid", async () => { - //a token from jwt.io, not encrypted with the same secret - const token = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; - const { status } = await getMe(token); - expect(status).toEqual(FORBIDDEN); - }); + it("Resopnds with FORBIDDEN if the JWT token is present, but not valid", async () => { + //a token from jwt.io, not encrypted with the same secret + const token = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; + const { status } = await getMe(token); + expect(status).toEqual(FORBIDDEN); + }); - it("Responds with OK if the user is logged in", async () => { - const { status } = await getMe(await extractBearerToken(signUp())); + it("Responds with OK if the user is logged in", async () => { + const { status } = await getMe(await extractBearerToken(signUp())); - expect(status).toEqual(OK); - }); + expect(status).toEqual(OK); + }); - it("Returns the user object if the user is logged in", async () => { - const token = await extractBearerToken(signUp()); - const { body } = await getMe(token).expect(OK); + it("Returns the user object if the user is logged in", async () => { + const token = await extractBearerToken(signUp()); + const { body } = await getMe(token).expect(OK); - expect(body.email).toBeDefined(); - expect(body._id).toBeDefined(); - }); + expect(body.email).toBeDefined(); + expect(body._id).toBeDefined(); + }); - it("Does not return the password hash to client", async () => { - expect( - (await getMe(await extractBearerToken(signUp()))).body.password_hash - ).toBeUndefined(); - }); + it("Does not return the password hash to client", async () => { + expect( + (await getMe(await extractBearerToken(signUp()))).body.password_hash + ).toBeUndefined(); + }); - it("Does return user data for the correct user", async () => { - const credentials = test.mocks.credentials(); + it("Does return user data for the correct user", async () => { + const credentials = test.mocks.credentials(); - const { body, status } = await getMe( - await extractBearerToken(signUp(credentials)) - ); + const { body, status } = await getMe( + await extractBearerToken(signUp(credentials)) + ); - expect(status).toEqual(OK); - expect(body.email).toEqual(credentials.email); - }); + expect(status).toEqual(OK); + expect(body.email).toEqual(credentials.email); + }); - it("Responds with FORBIDDEN if there is a token, but it's not properly formatted", async () => { - const { status } = await getMe("badly formatted token"); - expect(status).toEqual(FORBIDDEN); - }); + it("Responds with FORBIDDEN if there is a token, but it's not properly formatted", async () => { + const { status } = await getMe("badly formatted token"); + expect(status).toEqual(FORBIDDEN); + }); - it("Responds with OK if user is logged in", async () => { - const token = await extractBearerToken(signUp()); + it("Responds with OK if user is logged in", async () => { + const token = await extractBearerToken(signUp()); - const { status } = await getMe(token); - expect(status).toEqual(OK); - }); + const { status } = await getMe(token); + expect(status).toEqual(OK); }); +}); - describe("PUT endpont for token refresh", () => { - const refreshToken = (oldToken: string) => - supertest(app) - .put("/users/sessions") - .set("Authorization", "Bearer " + oldToken); +describe("PUT endpont for token refresh", () => { + const refreshToken = (oldToken: string) => + supertest(app) + .put("/users/sessions") + .set("Authorization", "Bearer " + oldToken); - it("Responds with OK on valid request", async () => { - const token = await extractBearerToken(signUp()); - const { status } = await refreshToken(token); + it("Responds with OK on valid request", async () => { + const token = await extractBearerToken(signUp()); + const { status } = await refreshToken(token); - expect(status).toEqual(OK); - }); + expect(status).toEqual(OK); + }); - it("Responds with a different token on valid request", async () => { - const oldToken = await extractBearerToken(signUp()); + it("Responds with a different token on valid request", async () => { + const oldToken = await extractBearerToken(signUp()); - await test.sleep(1200); //to update JWT `.iat` - const response = await refreshToken(oldToken); - const newToken = response.body.token; + await test.sleep(1200); //to update JWT `.iat` + const response = await refreshToken(oldToken); + const newToken = response.body.token; - expect(oldToken).toBeDefined(); - expect(newToken).toBeDefined(); - expect(oldToken).not.toEqual(newToken); - }); + expect(oldToken).toBeDefined(); + expect(newToken).toBeDefined(); + expect(oldToken).not.toEqual(newToken); }); - +}); diff --git a/packages/authentication/src/routes/user-routes.ts b/packages/authentication/src/routes/user-routes.ts index 48390c44..d315fd5e 100644 --- a/packages/authentication/src/routes/user-routes.ts +++ b/packages/authentication/src/routes/user-routes.ts @@ -42,62 +42,57 @@ export const userRoutes = express return response.status(UNAUTHORIZED).send(); } }) - .delete("/users/sessions", middleware.withAuthentication( - (request, response, user) => { - - //FIXME: somehow invalidate old token - response - .status(NO_CONTENT) - .send({ - token: null - }); - } - )) - .put("/users/sessions", middleware.withAuthentication( - async (request, response, user) => { - - const token = jwt.sign(user); - response - .status(OK) - .send({ - token - }); - } - )) - .post("/users", async (request, response) => { - - const credentials = request.body as models.UserCredentials; + .delete( + "/users/sessions", + middleware.withAuthentication((request, response, user) => { + //FIXME: somehow invalidate old token + response.status(NO_CONTENT).send({ + token: null, + }); + }) + ) + .put( + "/users/sessions", + middleware.withAuthentication(async (request, response, user) => { + const token = jwt.sign(user); + response.status(OK).send({ + token, + }); + }) + ) + .post("/users", async (request, response) => { + const credentials = request.body as models.UserCredentials; - if (!credentials || !credentials.email || !credentials.password || !validators.validatePassword(credentials.password) || !validators.validateEmail(credentials.email)) - return response - .status(BAD_REQUEST) - .send(); + if ( + !credentials || + !credentials.email || + !credentials.password || + !validators.validatePassword(credentials.password) || + !validators.validateEmail(credentials.email) + ) + return response.status(BAD_REQUEST).send(); - const existing = await database.users.getByEmail(credentials.email); + const existing = await database.users.getByEmail(credentials.email); - if (existing) return response - .status(CONFLICT) - .send(); + if (existing) return response.status(CONFLICT).send(); - const user = await database.users.insert({ - _id: nanoid(), - email: credentials.email.toLowerCase(), - password_hash: await hash.hash(credentials.password) - }); + const user = await database.users.insert({ + _id: nanoid(), + email: credentials.email.toLowerCase(), + password_hash: await hash.hash(credentials.password), + }); - const token = jwt.sign(user); + const token = jwt.sign(user); - return response - .status(CREATED) - .send({ token }); + return response.status(CREATED).send({ token }); + }) + .get( + "/users/me", + middleware.withAuthentication((request, response, user) => { + //THINKABOUT: /users/:id + response.json({ + ...user, + password_hash: undefined, + }); }) - .get( - "/users/me", - middleware.withAuthentication((request, response, user) => { - - //THINKABOUT: /users/:id - response.json({ - ...user, - password_hash: undefined - }); - })); + ); diff --git a/packages/common/src/validators/validators.test.ts b/packages/common/src/validators/validators.test.ts index bb866aa6..a1d5c516 100644 --- a/packages/common/src/validators/validators.test.ts +++ b/packages/common/src/validators/validators.test.ts @@ -40,32 +40,26 @@ describe("Common validators", () => { }); describe("Validastion of emails", () => { + it("Does returns true on a valid email", () => { + const email = faker.internet.email(); + expect(validateEmail(email)).toBe(true); + }); - it("Does returns true on a valid email", () => { - - const email = faker.internet.email(); - expect(validateEmail(email)).toBe(true); - }); - - it("Does return false on email without @", () => { - - expect(validateEmail("example.com")).toBe(false); - }); - - it("Does return false on email without TLD", () => { - - expect(validateEmail("mail@example")).toBe(false); - }); - - it("Does return false on email without prefix to before host", () => { + it("Does return false on email without @", () => { + expect(validateEmail("example.com")).toBe(false); + }); - expect(validateEmail("@example.com")).toBe(false); - }); + it("Does return false on email without TLD", () => { + expect(validateEmail("mail@example")).toBe(false); + }); - it("Does return false on email without domain name", () => { + it("Does return false on email without prefix to before host", () => { + expect(validateEmail("@example.com")).toBe(false); + }); - expect(validateEmail("mail@.com")).toBe(false); - }); + it("Does return false on email without domain name", () => { + expect(validateEmail("mail@.com")).toBe(false); + }); }); }); -}); \ No newline at end of file +}); diff --git a/packages/common/src/validators/validators.ts b/packages/common/src/validators/validators.ts index 328e0307..5b158d8f 100644 --- a/packages/common/src/validators/validators.ts +++ b/packages/common/src/validators/validators.ts @@ -7,16 +7,15 @@ * @param password */ export const validatePassword = (password: string) => - password.length >= 8 && - [/[a-z]/, - /[A-Z]/, - /[0-9]/,] - .map(pattern => pattern.test(password)) - .every(match => match); + password.length >= 8 && + [/[a-z]/, /[A-Z]/, /[0-9]/] + .map((pattern) => pattern.test(password)) + .every((match) => match); /** - * Checks whether the given email address looks like an email address. + * Checks whether the given email address looks like an email address. */ export const validateEmail = (email: string) => - /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ - .test(email); + /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( + email + ); diff --git a/packages/converter/src/rss.ts b/packages/converter/src/rss.ts index bb551192..662876a4 100644 --- a/packages/converter/src/rss.ts +++ b/packages/converter/src/rss.ts @@ -1,7 +1,6 @@ import { serialize, tag } from "serialize-xml"; import { models, constants } from "@paperpod/common"; - export const convertToRSSFeed = (articles: models.Article[]) => serialize( tag( diff --git a/packages/ui/src/a.tsx b/packages/ui/src/a.tsx index 959a089d..ab7e2d36 100644 --- a/packages/ui/src/a.tsx +++ b/packages/ui/src/a.tsx @@ -1,5 +1,5 @@ import { styled } from "./stitches.config"; export const A = styled("a", { - color: "inherit" -}); \ No newline at end of file + color: "inherit", +}); diff --git a/packages/ui/src/button.tsx b/packages/ui/src/button.tsx index a691dad4..07075760 100644 --- a/packages/ui/src/button.tsx +++ b/packages/ui/src/button.tsx @@ -1,27 +1,27 @@ import { styled } from "./stitches.config"; export const Button = styled("button", { - color: "$secondary", - backgroundColor: "$primary", - padding: "$thirteen", - paddingLeft: "$fiftyfive", - paddingRight: "$fiftyfive", - margin: "$five", - fontSize: "$twentyone", - fontWeight: "lighter", - outline: 'none', - border: "solid 1px", - borderRadius: "15px", - transition: "all 0s ease 1s", + color: "$secondary", + backgroundColor: "$primary", + padding: "$thirteen", + paddingLeft: "$fiftyfive", + paddingRight: "$fiftyfive", + margin: "$five", + fontSize: "$twentyone", + fontWeight: "lighter", + outline: "none", + border: "solid 1px", + borderRadius: "15px", + transition: "all 0s ease 1s", + "&:hover": { + textDecoration: "underline", + cursor: "pointer", + }, + "&:disabled": { + color: "grey", + opacity: 0.79, "&:hover": { - textDecoration: "underline", - cursor: "pointer", + cursor: "default", }, - "&:disabled": { - color: "grey", - opacity: .79, - "&:hover": { - cursor: "default", - } - } + }, }); diff --git a/packages/ui/src/paragraph.tsx b/packages/ui/src/paragraph.tsx index 38930fea..0a353cf1 100644 --- a/packages/ui/src/paragraph.tsx +++ b/packages/ui/src/paragraph.tsx @@ -1,30 +1,29 @@ import { styled } from "./stitches.config"; - export const Paragraph = styled("p", { - fontFamily: "Roboto, sans-serif", - fontWeight: "lighter", - fontSize: "$twentyone", - lineHeight: "34px", + fontFamily: "Roboto, sans-serif", + fontWeight: "lighter", + fontSize: "$twentyone", + lineHeight: "34px", - variants: { - size: { - larger: { - fontSize: "$thirtyfour", - lineHeight: "55px", - } - }, - error: { - true: { - color: "$error" - } - }, - centered: { - true: { - textAlign: "center", - alignSelf: "center", - justifySelf: "center", - } - } - } -}); \ No newline at end of file + variants: { + size: { + larger: { + fontSize: "$thirtyfour", + lineHeight: "55px", + }, + }, + error: { + true: { + color: "$error", + }, + }, + centered: { + true: { + textAlign: "center", + alignSelf: "center", + justifySelf: "center", + }, + }, + }, +}); diff --git a/packages/ui/src/stitches.config.ts b/packages/ui/src/stitches.config.ts index c751204e..a321612a 100644 --- a/packages/ui/src/stitches.config.ts +++ b/packages/ui/src/stitches.config.ts @@ -2,36 +2,12 @@ import { createCss } from "@stitches/react"; export const { styled, css, getCssString } = createCss({ - theme: { - colors: { - "primary": 'white', - "secondary": 'black', - "grey": 'hsl(0, 0%, 36%)', - "error": "red", - }, - space: { - one: '1px', - two: '2px', - three: '3px', - five: '5px', - eight: '8px', - thirteen: '13px', - twentyone: '21px', - thirtyfour: '34px', - fiftyfive: '55px', - seventynine: '79px', - onehunderedandfourteen: '114px', - }, - fontSizes: { - five: '5px', - eight: '8px', - thirteen: '13px', - twentyone: '21px', - thirtyfour: '34px', - fiftyfive: '55px', - seventynine: '79px', - onehunderedandfourteen: '114px', - } + theme: { + colors: { + primary: "white", + secondary: "black", + grey: "hsl(0, 0%, 36%)", + error: "red", }, space: { one: "1px", @@ -57,9 +33,4 @@ export const { styled, css, getCssString } = createCss({ onehunderedandfourteen: "114px", }, }, - conditions: { - small: `@media (max-width: 768px)`, - large: `@media (min-width: 768px)`, - }, - utils: {}, }); diff --git a/packages/web/components/authentication/UserContext.tsx b/packages/web/components/authentication/UserContext.tsx index 70509bdd..525ee75c 100644 --- a/packages/web/components/authentication/UserContext.tsx +++ b/packages/web/components/authentication/UserContext.tsx @@ -20,22 +20,23 @@ const useUser = (token: string): models.User => { const router = useRouter(); useEffect(() => { - (async () => { + (async () => { + if (!token) return setUser(null); + const [status, user] = await get( + "/authentication/users/me/", + { + headers: { + authorization: "Bearer " + token, + }, + } + ); - if (!token) return setUser(null); - const [status, user] = await get("/authentication/users/me/", { - headers: { - authorization: "Bearer " + token, - }, - }); - - setUser(status === OK ? user : null); - if (user) router.push("/home"); + setUser(status === OK ? user : null); + if (user) router.push("/home"); + })(); + }, []); - })() - }, []); - - return user; + return user; }; export const UserContextProvider = ({ children }: any) => { diff --git a/packages/web/components/authentication/authFetchers.ts b/packages/web/components/authentication/authFetchers.ts index 19be98dd..9703f46d 100644 --- a/packages/web/components/authentication/authFetchers.ts +++ b/packages/web/components/authentication/authFetchers.ts @@ -8,10 +8,11 @@ export const signup = (credentials: models.UserCredentials) => credentials ); -export const login = (credentials: models.UserCredentials) => post< - models.UserCredentials, - models.TokenResponse - >("/authentication/users/sessions", credentials); +export const login = (credentials: models.UserCredentials) => + post( + "/authentication/users/sessions", + credentials + ); export const logout = (token: string) => del("/authentication/users/sessions", bearer(token)); diff --git a/packages/web/components/authentication/authentication.tsx b/packages/web/components/authentication/authentication.tsx index 51a24ef5..fad8f877 100644 --- a/packages/web/components/authentication/authentication.tsx +++ b/packages/web/components/authentication/authentication.tsx @@ -1 +1 @@ -export { UserContext, UserContextProvider } from "./UserContext"; \ No newline at end of file +export { UserContext, UserContextProvider } from "./UserContext"; diff --git a/packages/web/components/layout/footer.tsx b/packages/web/components/layout/footer.tsx index 8ea98ac8..5b8890c1 100644 --- a/packages/web/components/layout/footer.tsx +++ b/packages/web/components/layout/footer.tsx @@ -1,21 +1,27 @@ -import { styled, Paragraph } from "@paperpod/ui" +import { styled, Paragraph } from "@paperpod/ui"; const Container = styled("footer", { - height: "20vh", - bottom: "-20vh", - position: "absolute", - left: 0, - width: "100vw", - fontSize: "$twentyone", - display: "flex", - flexDirection: "column", - alignItems: "flex-start", + height: "20vh", + bottom: "-20vh", + position: "absolute", + left: 0, + width: "100vw", + fontSize: "$twentyone", + display: "flex", + flexDirection: "column", + alignItems: "flex-start", }); -export const Footer = () => +export const Footer = () => ( + - Get in touch + Get in touch Paperpod is made by Krets AS - You are using an unfinished version of Paperpod. Visit Github to follow development -; + + You are using an unfinished version of Paperpod. Visit{" "} + Github to follow + development + + +); diff --git a/packages/web/components/layout/header/header.tsx b/packages/web/components/layout/header/header.tsx index 0b4b4230..f56f9546 100644 --- a/packages/web/components/layout/header/header.tsx +++ b/packages/web/components/layout/header/header.tsx @@ -3,17 +3,18 @@ import Link from "next/link"; import { Image } from "./image"; const Container = styled("div", { - width: "100vw", - display: "flex", - justifyContent: "flex-start", + width: "100vw", + display: "flex", + justifyContent: "flex-start", }); - -export const Header = () => +export const Header = () => ( + - + {/* Navbutton 1 Navbutton 2 Navbutton 3 */} - + +); diff --git a/packages/web/components/layout/header/image.tsx b/packages/web/components/layout/header/image.tsx index 3804db13..f85095bb 100644 --- a/packages/web/components/layout/header/image.tsx +++ b/packages/web/components/layout/header/image.tsx @@ -1,9 +1,9 @@ import { styled } from "@paperpod/ui"; export const Image = styled("img", { - height: "$twentyone", - width: "21%", - "small": { - display: "none", - } + height: "$twentyone", + width: "21%", + small: { + display: "none", + }, }); diff --git a/packages/web/components/layout/layout.tsx b/packages/web/components/layout/layout.tsx index f464c0f1..16eae4bf 100644 --- a/packages/web/components/layout/layout.tsx +++ b/packages/web/components/layout/layout.tsx @@ -22,5 +22,4 @@ export const Layout = (props) => { {props.children}