-
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
7 changed files
with
83 additions
and
209 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
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
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,14 @@ | ||
import http from "./httpService"; | ||
import { apiUrl } from "../config.json"; | ||
import auth from "./authService"; | ||
|
||
const apiEndpoint = apiUrl + "/forms"; | ||
const formKey = "form"; | ||
|
||
export function getUserForm() { | ||
let userId = auth.getCurrentUser().id; | ||
return http.get(`${apiEndpoint}/${userId}`, { | ||
headers: { "x-auth-token": `T_${auth.getJwt()}` }, | ||
}); | ||
try { | ||
const form = localStorage.getItem(formKey); | ||
return JSON.parse(form); | ||
} catch (ex) { | ||
return null; | ||
} | ||
} | ||
|
||
export function updateUserForm(userForm) { | ||
const tempForm = { ...userForm }; | ||
delete tempForm.likesDislikes; | ||
delete tempForm.blackList; | ||
return http.put(`${apiEndpoint}/`, tempForm, { | ||
headers: { "x-auth-token": `T_${auth.getJwt()}` }, | ||
}); | ||
export function saveForm(form) { | ||
localStorage.setItem(formKey, JSON.stringify(form)); | ||
} |
Oops, something went wrong.