Got user login functional using Moonstream application on Brood

pull/37/head
Neeraj Kashyap 2021-07-31 12:40:22 -07:00
rodzic 12e3d576eb
commit 30d905b68f
7 zmienionych plików z 5 dodań i 18 usunięć

Wyświetl plik

@ -82,7 +82,7 @@ const EntriesNavigation = () => {
);
_setNewFilterState(props);
},
[subscriptionsCache.data.subscriptions]
[subscriptionsCache?.data?.subscriptions]
);
const loadMoreButtonRef = useRef(null);

Wyświetl plik

@ -28,7 +28,7 @@ const useLogin = (loginType) => {
if (!data) {
return;
}
localStorage.setItem("MOONSTREAM_ACCESS_TOKEN", data.data.access_token);
localStorage.setItem("MOONSTREAM_ACCESS_TOKEN", data.data.id);
const invite_code = window.sessionStorage.getItem("invite_code");
if (invite_code) {
inviteAccept(invite_code);

Wyświetl plik

@ -1 +0,0 @@
export const AUTH_URL = process.env.NEXT_PUBLIC_SIMIOTICS_AUTH_URL;

Wyświetl plik

@ -1,7 +1,7 @@
import React, { useState, useEffect, useCallback } from "react";
import http from "axios";
import { AUTH_URL } from "./constants";
import UserContext from "./context";
import { AUTH_URL } from "../../services/auth.service";
const UserProvider = ({ children }) => {
const [user, setUser] = useState();
@ -16,7 +16,7 @@ const UserProvider = ({ children }) => {
const headers = { Authorization: `Bearer ${token}` };
http
.get(`${AUTH_URL}/user`, { headers })
.get(`${AUTH_URL}/`, { headers })
.then((response) => {
setUser(response.data);
})

Wyświetl plik

@ -1,7 +1,7 @@
import { http } from "../utils";
const API_URL = process.env.NEXT_PUBLIC_MOONSTREAM_API_URL;
const AUTH_URL = `${API_URL}/users`;
export const AUTH_URL = `${API_URL}/users`;
export const login = ({ username, password }) => {
const data = new FormData();

Wyświetl plik

@ -7,7 +7,6 @@ import * as GroupService from "./group.service";
import * as PreferencesService from "./preferences.service";
import * as HumbugService from "./humbug.service";
import * as InvitesService from "./invites.service";
import * as UserService from "./user.service";
import * as SubscriptionsService from "./subscriptions.service";
export {
@ -20,6 +19,5 @@ export {
PreferencesService,
HumbugService,
InvitesService,
UserService,
SubscriptionsService,
};

Wyświetl plik

@ -1,10 +0,0 @@
import { http } from "../utils";
const AUTH_URL = process.env.NEXT_PUBLIC_SIMIOTICS_AUTH_URL;
export const findUser = (query) => {
return http({
method: "GET",
url: `${AUTH_URL}/user/find?${query}`,
});
};