Skip to content

Commit

Permalink
fix: better syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Intevel committed Mar 26, 2022
1 parent 47b7027 commit dba462e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/runtime/composables/useDirectusAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const useDirectusAuth = () => {
if (token.value && !user.value) {
try {
var res = await directus("/users/me");
//@ts-ignore
setUser(res.data);
} catch (e) {
setToken(null);
Expand All @@ -43,10 +44,13 @@ export const useDirectusAuth = () => {
): Promise<DirectusAuthResponse> => {
setToken(null);

const response: DirectusAuthResponse = await directus("/auth/login", {
method: "POST",
body: data,
});
const response: { data: DirectusAuthResponse } = await directus(
"/auth/login",
{
method: "POST",
body: data,
}
);

setToken(response.data.access_token);

Expand Down

0 comments on commit dba462e

Please sign in to comment.