Skip to content

Commit

Permalink
Merge pull request #5 from puneet222/master
Browse files Browse the repository at this point in the history
Added logout action
  • Loading branch information
s-garg authored Mar 19, 2021
2 parents 8f5a3fd + a9a55d2 commit a938bf7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/actions/get_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ACCESS_TOKEN } from '../utils/constants'
const returnOptions = () => {
if (!ACCESS_TOKEN) {
return JSON.stringify({
remove: ['workspaces']
remove: ['workspaces', 'logout']
});
} else {
return JSON.stringify({
Expand Down
10 changes: 10 additions & 0 deletions src/actions/logout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @description Logout from asana automation package

setVars([
{
name: 'asanaAccessToken',
value: '',
},
], { local: true });
notify('Access token removed successfully', 'success', 3000);
reIndex([]);
2 changes: 1 addition & 1 deletion src/actions/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ if (!token) {
},
], { local: true });
notify('Access token added successfully', 'success', 3000);
reIndex();
reIndex([]);
}
12 changes: 6 additions & 6 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ export const getWorkspaces = (): DecodedAPIResponse => {

export const getWorkspaceTeams = (workspaceId: number): DecodedAPIResponse => {
return decodeApiResponse(
httpGet(getUrl(`/organizations/${workspaceId}/teams?opt_fields=${TEAM_OPTIONS}&limit=10`), {
httpGet(getUrl(`/organizations/${workspaceId}/teams?opt_fields=${TEAM_OPTIONS}&limit=10&date=${new Date().getTime()}`), {
Authorization: `Bearer ${ACCESS_TOKEN}`
})
);
}

export const getTeamProjects = (teamId: number): DecodedAPIResponse => {
return decodeApiResponse(
httpGet(getUrl(`/teams/${teamId}/projects?opt_fields=${PROJECT_OPTIONS}&limit=10`), {
httpGet(getUrl(`/teams/${teamId}/projects?opt_fields=${PROJECT_OPTIONS}&limit=10&date=${new Date().getTime()}`), {
Authorization: `Bearer ${ACCESS_TOKEN}`
})
);
}

export const getWorkspaceProjects = (workspaceId: number): DecodedAPIResponse => {
return decodeApiResponse(
httpGet(getUrl(`/workspaces/${workspaceId}/projects?opt_fields=${PROJECT_OPTIONS}&limit=10`), {
httpGet(getUrl(`/workspaces/${workspaceId}/projects?opt_fields=${PROJECT_OPTIONS}&limit=10&date=${new Date().getTime()}`), {
Authorization: `Bearer ${ACCESS_TOKEN}`
})
);
}

export const getTeamUsers = (teamId: number): DecodedAPIResponse => {
return decodeApiResponse(
httpGet(getUrl(`/teams/${teamId}/users?limit=10`), {
httpGet(getUrl(`/teams/${teamId}/users?limit=10&date=${new Date().getTime()}`), {
Authorization: `Bearer ${ACCESS_TOKEN}`
})
);
Expand Down Expand Up @@ -123,15 +123,15 @@ export const updateSection = (sectionId: number, sectionData: UpdateSectionData)

export const getProjectTasks = (projectId: number): DecodedAPIResponse => {
return decodeApiResponse(
httpGet(getUrl(`/projects/${projectId}/tasks?opt_fields=${TASK_OPTIONS}&limit=50`), {
httpGet(getUrl(`/projects/${projectId}/tasks?opt_fields=${TASK_OPTIONS}&limit=10&date=${new Date().getTime()}`), {
Authorization: `Bearer ${ACCESS_TOKEN}`
})
);
}

export const getSectionTasks = (sectionId: number): DecodedAPIResponse => {
return decodeApiResponse(
httpGet(getUrl(`/sections/${sectionId}/tasks?opt_fields=${TASK_OPTIONS}&limit=30`), {
httpGet(getUrl(`/sections/${sectionId}/tasks?opt_fields=${TASK_OPTIONS}&limit=20&date=${new Date().getTime()}`), {
Authorization: `Bearer ${ACCESS_TOKEN}`
})
);
Expand Down

0 comments on commit a938bf7

Please sign in to comment.